Snapshots
Skytable supports automated snapshots that can be used for periodic backups. Skytable’s snapshotting system is dead simple and works in a similar way to BGSAVE.
Enabling snapshots
Snapshots aren’t enabled by default — you have to enable them by using the configuration file or command line arguments. To your existing configuration file, just add the following block:
[snapshot]
every = 3600
atmost = 4
failsafe = true # optional
Here’s what these values mean:
every
- Number of seconds to wait before creating another snapshotatmost
- The maximum number of snapshots to keepfailsafe
- This indicates whether the database should stop accepting write operations if snapshotting fails
Storage of snapshots
All the created snapshots are stored in a data/snaps
folder in the current directory. The snapshot folders are named in the format: YYYYMMDD-HHMMSS
. On the other hand, remote snapshots are stored in the data/rsnap
folder.
How snapshots work
As mentioned earlier, snapshots work just like BGSAVE
. A task is spawned that starts encoding (and writing data) to a folder (which appears to be a copy of the ks folder); once all the data is successfully flushed to disk, the task exits.
Methods of creating snapshots
Snapshots can be created automatically by using the configuration file. However, if you want to create snapshots remotely, you can use the MKSNAP action. This will only create snapshots if it is enabled on the server-side, unless you use truly remote snapshots.
Remote snapshots
Irrespective of whether snapshots are enabled on the server side, you can use truly remote snapshots. Such snapshots can be created by using the MKSNAP action. To do this, pass a second argument to MKSNAP
with the desired name of your snapshot. This will create a snapshot in the data/rsnap
directory.
tip
Since snapshots are intended for data backups — you can do a little trick to make these backups offsite-backups: mount a network file system or a different drive and create a folder for storing your snapshots in it. Now, symlink the data/snaps
directory to your remotely mounted directory. You now have offsite backups!