Link Search Menu Expand Document
Start for Free

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

Page Contents
  1. Overview
  2. Server Backup
  3. Server Restore

Overview

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.

Server Backup

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.

Server Restore

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.

By default 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

The 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.