AllegroGraph supports online full backups. A full backup contains all data files and information required to restore a database to the state it was in at the time of the backup. Online backups are performed while the database is running.
The backup program is used both for backing up data for use later by the same server and for backing up data which will be upgraded to a new (later) version. The program convertdb, which was previously used to convert datbases for new AllegroGraph versions, is no longer needed.
Starting in 4.4, the backup utility backs up the data (all the triples) and the server configuration. This makes upgrading easier (see Database Upgrade).
The backup and restore programs must be run by the user id under which the AllegroGraph server is running (commonly the
The agraph-backup program must be run on the same machine as the AllegroGraph server.
Performing an Online Full Backup
su to the user id under which the AllegroGraph server is running (usually the agraph user).
Run agraph-backup with the appropriate arguments. We show two cases for backups:
agraph-backup [--port <port>] [--catalog <catalog>] backup <dbname> <archive>
<dbname> is the name of the repository database.
<catalog> is the catalog that contains the repository. If you want the root catalog, omit the --catalog argument.
Use the --port flag if your database server is running on a non-default port.
<archive> is the archive file to write. This file must not exist before this command is run. If the <archive> filename is a hypen (-) then the backup will be written to standard output.
This command backs up a specific database specified by dbname. The database is recovered with the restore option mentioned below.
agraph-backup [--port <port>] [--catalog <catalog>] backup-all <archive-dir>
port, and catalog are as above.
<archive-dir> is the directory where individual archive files will be written. This archive files must not exist before this command is run.
backup-all archives all databases in the running AllegroGraph server. Settings information is also stored. Use the restore-all option to restore the backup.
Performing a Restore
Make sure that AllegroGraph server is running, and restore the backup to a database name that does not exist yet on this server. You cannot restore over an existing database.
Run agraph-backup with the appropriate arguments. There are two choice for restoring: restore and restore-all. Here is the command with restore
agraph-backup [--port <port>] [--catalog <catalog>] [--replica] [--nocommit] [--newuuid] [--recover] restore <dbname> <archive>
Restore the database saved by agraph-backup called with backup contained in the archive file <archive>, and give it the local name <dbname>. <archive> specifies the archive file to restore from. It may be specified as
- in order to read the archive data from standard input. (See the section below on copying databases.)
When --replica is given, the restored database is assumed to be a replication secondary (warmstandby client). It will cause --nocommit to be set. See Replication and Warm Standby. This flag is incompatible with --newuuid and --recover.
When --nocommit is given, the newly restored database will be set to no-commit mode.
When --newuuid is given a new uuid will be generated for the database.
When --recover is given it will cause both --nocommit and --newuuid to be given.
Here is the call with restore-all:
agraph-backup [--port <port>] [--catalog <catalog>] [--nocommit] [--newuuid] [--recover] [--nosettings] restore_all <archive-dir>
Restores multiple database and settings information archived in archive-dir by agraph-backup called with backup-all. The catalogs which existed when the databases were archived must exist in the running server. Settings information is restored as well (specify --nosettings to prevent that). If settings are restored, you must restart the server before continuing.
Using agraph-backup to copy databases
agraph-backup can be used to copy a database to a new name and/or catalog. This is achieved by setting up a pipe with agraph-backup backup writing the database to standard output, and agraph-backup restore reading the backup archive into a different database. For example, to make a copy of the database lubm1 under the name lubm1 in the catalog experiments, the following command line could be used:
agraph-backup backup lubm1 - | agraph-backup --catalog experiments --newuuid restore lubm1 -
Note that a triple-store copy needs a --newuuid if it is to run on the same server as the original triple store. Alternately, you could specify the --port number to send the copy to a different server on the same computer. In that case the --newuuid isn't necessary.
Restoring a Pre-v4.1 backup
AllegroGraph versions prior to v4.1 used a different backup mechanism. Databases saved using 4.0.x agraph-backup need to be restored using the agraph-restore-v4.0. Please contact firstname.lastname@example.org if you require assistance restoring v4.0 backups into AllegroGraph v4.1 or newer.
Calling agraph-backup* without arguments displays help information but does nothing else.