title | summary | toc | docs_area |
---|---|---|---|
Run Bulk Operations from Your Cluster |
Run backups, restores, and imports from your CockroachDB Cloud cluster. |
true |
manage |
{{ site.data.products.serverless }} and {{ site.data.products.dedicated }} offer different levels of support for the following bulk operations. This page provides information on the availability of these operations in both types of {{ site.data.products.db }} cluster and examples.
{{site.data.alerts.callout_info}}
For {{ site.data.products.serverless }} clusters, you must have billing information on file for your organization to have access to cloud storage. If you don't have billing set up, userfile
is your only available storage option for bulk operations. {{ site.data.products.dedicated }} users can run bulk operations with userfile
or cloud storage.
{{site.data.alerts.end}}
For information on userfile
commands, visit the following pages:
The cloud storage examples on this page use Amazon S3 for demonstration purposes. For guidance on connecting to other storage options or using other authentication parameters, read Use Cloud Storage for Bulk Operations.
{{site.data.alerts.callout_danger}} You cannot restore a backup of a multi-region database into a single-region database. {{site.data.alerts.end}}
Before you begin, connect to your cluster. For guidance on connecting to your {{ site.data.products.db }} cluster, visit Connect to a {{ site.data.products.serverless }} Cluster or Connect to Your {{ site.data.products.dedicated }} Cluster.
userfile
Cloud storage
{% include cockroachcloud/userfile-examples/backup-userfile.md %}
Cockroach Labs runs full backups daily and incremental backups hourly for every {{ site.data.products.db }} cluster. The full backups are retained for 30 days, while incremental backups are retained for 7 days. For more information, read Restore Data From a Backup.
The following examples show how to run manual backups and restores:
{% include cockroachcloud/backup-examples.md %}
{% include cockroachcloud/restore-examples.md %}
For more information on taking backups and restoring to your cluster, read the following pages:
userfile
Cloud storage
{% include cockroachcloud/userfile-examples/import-into-userfile.md %}
To import a table into your cluster:
{% include_cached copy-clipboard.html %}
> IMPORT TABLE customers (
id UUID PRIMARY KEY,
name TEXT,
INDEX name_idx (name)
)
CSV DATA ('s3://{BUCKET NAME}/{customer-data}?AWS_ACCESS_KEY_ID={ACCESS KEY}&AWS_SECRET_ACCESS_KEY={SECRET ACCESS KEY}')
;
Read the IMPORT
page for more examples and guidance.
{{site.data.alerts.callout_info}}
Using EXPORT
with userfile
is not recommended. If you need to export data from a Serverless cluster, you can either set up billing for your organization to access cloud storage or export data to a local CSV file.
{{site.data.alerts.end}}
The following example exports the customers
table from the bank
database into a cloud storage bucket in CSV format:
EXPORT INTO CSV
's3://{BUCKET NAME}/{customer-export-data}?AWS_ACCESS_KEY_ID={ACCESS KEY}&AWS_SECRET_ACCESS_KEY={SECRET ACCESS KEY}'
WITH delimiter = '|' FROM TABLE bank.customers;
Read the EXPORT
page for more examples and guidance.