Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make backups/snapshots in CockroachDB?

Tags:

cockroachdb

How do I create backups of my entire cluster? Can they only be imported back into CockroachDB or can they also be imported into other systems?

like image 895
Alex Robinson Avatar asked Sep 03 '25 02:09

Alex Robinson


2 Answers

CockroachDB support generating a snapshot of your entire cluster with the cockroach dump command. This creates a human-readable output of SQL statements that can be easily imported into other databases, if so desired. Here’s an example of dumping two tables from the same database:

cockroach dump db1 tbl1 tbl2 > db1_backup.sql

We’re also working on a much more performant, efficient backup-and-restore functionality for our upcoming 1.0 release. The files from the new backup functionality will only be restorable into CockroachDB, however.

like image 79
Alex Robinson Avatar answered Sep 06 '25 11:09

Alex Robinson


the "more performant efficient backup-and-restore functionality" Alex mentioned has been available for awhile now. documentation is here:

https://www.cockroachlabs.com/docs/stable/backup.html

Cockroach Labs calls the open source version of the database "Cockroach Core", so open source users should note the caveat at the top of the page:

"Core users can only take full backups. To use the other backup features, you need an enterprise license."

like image 40
Greg Goodman Avatar answered Sep 06 '25 11:09

Greg Goodman