A backup is a copy of your database. You can restore the state of the database as it existed at the time of the backup.
Backups are used for disaster recovery. When you create a backup it is wise to copy the backup to a different host. If you lose access to the host that houses your database, you restore the database from a backup on another host.
Backups have additional uses. Taking a backup of a database is often the easiest way to get a copy of the database. You can use this copy for development, testing, or analytics.
Dolt supports different methods of backup that leverage Dolt's git-style features.
Dolt databases contain the entire history of the database, meaning Dolt has backups built in to the running server. To restore to a previous point on a running server, you checkout the database at the commit you would like to restore to.
To replicate your database off host so you can restore if you lose the host, Dolt supports two different concepts: remotes and backups.
Interestingly, you can trigger backups from your application using the
dolt_backup()procedure. If you hit a weird edge case you can create a backup of the state of your database for debugging.
%% dolt backup add backup1 file://../backups/backup1
/ Tree Level: 1, Percent Buffered: 0.00% Files Written: 0, Files Uploaded: 1
$ dolt backup sync backup1
$ dolt backup restore file://./backups/backup1 repo2
$ dolt branch -a
$ dolt status