Backup & Restore
This page discusses backing up and restoring the Stardog server. For information backing up individual Stardog databases and restoring them, please see the page on Database Backups
Stardog 7+ supports backup/restore functionality for the entire system in one step
stardog-admin server backup and
stardog-admin server restore commands. This functionality is convenient when all databases need to be backed up and restored simultaneously.
The server backup requires as much disk space as production data. Best practice is to give a path to an independent storage volume, not the same volume as the production data. It is possible to crash Stardog by filling the storage volume that contains the production data.
Server backup will back up the entire Stardog server, all databases and associated metadata. Unlike database backups, which takes a full backup of the database every time it is run, server backup takes an incremental backup of the data. That way, each time the command is run only the updates to the databases since the last time backup need to be saved.
Server backups are accomplished with the following command:
$ stardog-admin server backup
You can optionally specify the backup location, otherwise the Stardog defaults will be used, similar to the
db backup command:
$ stardog-admin server backup /path/to/custom/backup/location
This command only supports file-based backups, it cannot be used with S3, for instance.
To copy the backups off local disk we recommend using a tool such as rclone. After setting up rclone you can use it to send the backups to another server:
$ rclone sync /path/to/backup/location/ sftp:/path/to/other/location/
Consult the rclone docs for the full list of supported storage systems.
You can use
server restore command to restore server backups created by
server backup. To do so you must shut down Stardog and set
$STARDOG_HOME to an empty home directory. The
server restore command will restore the complete server to
$STARDOG_HOME. Once complete you can start the Stardog server.
$ export STARDOG_HOME=/path/to/empty/stardog/home $ stardog-admin server restore /path/to/server/backup
Server backups do not contain your license file,
stardog.properties, or any other additional files or directories created externally under
STARDOG_HOME so you need to back up and restore those files and directories separately.
server restore will restore the latest backup found in the backup directory. The server configuration option
backup.keep.last.number.backups that can be set in
stardog.properties controls how many backups will be retained. By default, this option is set to
4 and any one of the older backups can be restored if desired by specifying a backup ID in the command:
$ stardog-admin server restore -b 3 /path/to/server/backup
server backup command prints the ID for the backup created which is the value that can be passed to the
server restore command. The backup IDs correspond to directories under the versions directory of the backup directory. The creation date for these directories will indicate when the corresponding backup was created.