Our databases contain valuable and business critical information and whilst there have always been manual ways to create restorable backups of Crate databases, as of version 0.53, we are pleased to announce the ‘Snapshots’ feature.
Snapshots allow you to create incremental backups of entire databases, specific tables or partitions and restore them through Crate’s command line interface, Crash.
Repositories can be stored on shared file systems accessible to the whole cluster, hdfs or a read-only repository url accessible over several protocols.
Creating a shared file system repository requires a couple of steps.
Add the absolute paths where repositories could be located to config/crate.yml:
path.repo: /crate/repos, /repos
Connect to a Crate cluster using the Crash cli tool and create the repository for storing snapshots, changing
location to appropriate values for your cluster:
create repository my_snapshots type fs with (location='crate_db', compress=true);
Create a snapshot,
snapshot1 is the name for this snapshot:
CREATE SNAPSHOT my_snapshots.snapshot1 ALL WITH (wait_for_completion=true);
This creates a snapshot of all tables, waiting until the snapshot is created. There are other configuration options available, read full documentation of the command here.
To restore a snapshot, drop any tables you want to restore:
DROP TABLE TABLE_NAME;
Now restore the table from a snapshot:
RESTORE SNAPSHOT my_snapshots.snapshot1 TABLE TABLE_NAME WITH (wait_for_completion=true);
For more details and best practice usage guides, head to our documentation.