This page provides an overview of the backup and restore features available in CockroachDB:
- Backup and restore types and their product availability
- SQL statements for working with backups and restores
- Storage for backups
You can create full or incremental backups of a cluster, database, or table. Taking regular backups of your data is an operational best practice.
For an explanation of how a backup works, see Backup Architecture.
Backup and restore types
The following table outlines the available backup and restore types in CockroachDB. See each of the pages linked in the table for usage examples:
Backup / Restore Type | Description | Product |
---|---|---|
Full backup | An un-replicated copy of your cluster, database, or table's data. A full backup is the base for any further backups. | All products |
Incremental backup | A copy of the changes in your data since the specified base backup (a full or full and incremental). | CockroachDB Dedicated CockroachDB Self-Hosted with an Enterprise license |
Backups with revision history | A backup with revision history allows you to back up every change made within the garbage collection period leading up to and including the given timestamp. | CockroachDB Dedicated CockroachDB Self-Hosted with an Enterprise license |
Point-in-time restore | A restore from an arbitrary point in time within the revision history of a backup. | CockroachDB Dedicated CockroachDB Self-Hosted with an Enterprise license |
Encrypted backup and restore | An encrypted backup using a KMS or passphrase. | CockroachDB Dedicated CockroachDB Self-Hosted with an Enterprise license |
Locality-aware backup and restore | A backup where each node writes files only to the backup destination that matches the node locality configured at node startup. | CockroachDB Dedicated CockroachDB Self-Hosted with an Enterprise license |
Scheduled backup | A schedule for periodic backups. | CockroachDB Dedicated CockroachDB Self-Hosted with an Enterprise license |
Automated backup | Cockroach Labs runs full backups daily and incremental backups hourly for every CockroachDB Cloud cluster. | CockroachDB Cloud clusters |
Backup and restore SQL statements
The following table outlines SQL statements you can use to create, configure, pause, and show backup and restore jobs:
SQL Statement | Description |
---|---|
BACKUP |
Create full and incremental backups. |
SHOW JOBS |
Show a list of all running jobs or show the details of a specific job by its job ID . |
PAUSE JOB |
Pause a backup or restore job with its job ID . |
RESUME JOB |
Resume a backup or restore job with its job ID . |
CANCEL JOB |
Cancel a backup or restore job with its job ID . |
SHOW BACKUP |
Show a backup's details at the backup collection's storage location. |
RESTORE |
Restore full and incremental backups. |
ALTER BACKUP |
Add a new KMS encryption key to an encrypted backup. |
Backup storage
We recommend taking backups to cloud storage and enabling object locking to protect the validity of your backups. CockroachDB supports Amazon S3, Azure Storage, and Google Cloud Storage for backups. Read the following usage information:
- Example file URLs to form the URL that you pass to
BACKUP
andRESTORE
statements. - Authentication to set up authentication to a cloud storage bucket and include those credentials in the URL.
For detail on additional cloud storage features CockroachDB supports:
- Object locking to prevent backups from being overwritten or deleted.
- Storage Class (AWS S3 only) to set a specific storage class for your backups.
See also
- Considerations for using backup and restore
- Backup collections for details on how CockroachDB stores backups