Backup and restore
A backup is a copy of your data that you keep outside the running database. You use it to get your data back after an event the database cannot repair on its own:
- You lose a disk or a whole server.
- Storage files become corrupt.
- A bad migration, a wrong script, or a bug in an application changes or deletes a large amount of data.
- You must return the database to its state at an exact moment, for example the minute before an incident. The moment must be inside the retention window.
A cluster keeps several copies of each write, but it does not replace a backup. Replication copies a bad change to every node as fast as a good change. Only a backup lets you go back to a point before the change.
Use this page when you need disaster recovery for a production node or cluster. For a smaller problem, a lighter tool is often faster:
- To read the earlier contents of a table while the server runs, use Time-travel reads.
- To undo an accidental
DROP TABLEorDROP DATABASE, use Recover dropped objects. - To copy data to another environment, or to keep an export in SQL, use camus-dump.
Which recovery tool to use compares the four tools.
How a CamusDB backup works
CamusDB takes a physical backup of its storage engine. The backup holds a base image plus the write-ahead log (WAL), the record of changes the engine wrote after that image. A restore can therefore target any moment inside the retention window, not only the instant of the backup.
A backup covers a whole node. Every database on a node shares one storage
engine (Kahuna), so one backup captures all of them
together. You cannot back up a single database or table, and there is no SQL
BACKUP statement. Backups are server administration operations, and CamusDB
exposes them over HTTP.
A restore is offline. It builds the storage into a fresh directory and never touches the running server. There is no in-place hot restore: you restore first, then start a server against the restored directory.
Why it works this way
This is the recovery path for a database that is too large for a dump. A logical export, such as camus-dump, reads every row through the SQL layer and writes it out as text. That works at gigabyte scale, but not at terabyte scale: the dump is slower than the disk, the file is larger than the data, and the restore must parse every statement, check every constraint, and build every index again. That replay can take hours or days.
A physical backup copies the base image and the WAL after it, so its cost follows the bytes on disk, not the row count. A restore is a file copy plus a WAL replay. An incremental backup keeps the steady cost close to the volume of change. Compressed and out-of-line large values are ordinary storage data, so a backup captures them with the rows that reference them, and a restore to an earlier point returns the large values each row pointed at then. See Large Values.
The two constraints above follow from this design:
- A backup covers a whole node because the image does. Taking one database out would mean reading it row by row, which is the logical dump this design avoids.
- A restore is offline because CamusDB cannot replace files that a running server holds open and caches. A build into a fresh directory leaves the live node untouched, and lets you verify the restore first.
PITR bootstrap with pitr_bootstrap_from requires RocksDB for both
kahuna.storage and kahuna.wal_storage; Solarium cannot be used for that
bootstrap path. See storage-engine choices.