OrientDB supports back and and restore operations, like any database management system.
BACKUP DATABASE command executes a complete backup on the currently open database. It compresses the backup the backup using the ZIP algorithm. To restore the database from the subsequent
.zip file, you can use the
RESTORE DATABASE command.
Backups and restores are much faster than the
EXPORT DATABASE and
IMPORT DATABASE commands. You can also automate backups using the Automatic Backup server plugin. Additionally, beginning with version 2.2 of Enterprise Edition OrientDB introduces major support for incremental backups.
During backups, the
BACKUP DATABASE command produces a consistent copy of the database. During this process, the database locks all write operations, waiting for the backup to finish. If you need perform reads and writes on the database during backups, set up a distributed cluster of nodes.
By contrast, the
EXPORT DATABASE command doesn't lock the database, allowing concurrent writes to occur during the export process. Consequentially, the export may include changes made after you initiated the export, which may result in inconsistencies.
Beginning in version 1.7.8, OrientDB introduces a
backup.sh script found in the
$ORIENTDB_HOME/bin directory. This script allows you to initiate backups from the system console.
./backup.sh <db-url> <user> <password> <destination> [<type>]
<db-url>Defines the URL for the database to back up.
<user>Defines the user to run the backup.
<password>Defines the password for the user.
<destination>Defines the path to the backup file the script creates, (use the
<type>Defines the backup type. Supported types:
defaultLocks the database during the backup.
lvmExecutes an LVM copy-on-write snapshot in the background.
Backup a database opened using
$ORIENTDB_HOME/bin/backup.sh plocal:../database/testdb \ admin adminpasswd \ /path/to/backup.zip
Perform a non-blocking LVM backup, using
$ORIENTDB_HOME/bin/backup.sh plocal:../database/testdb \ admin adminpasswd \ /path/to/backup.zip \ lvm
Perform a non-blocking LVM backup, using a remote database hosted at
$ORIENTDB_HOME/bin/backup.sh remote:localhost/testdb \ root rootpasswd \ /path/to/backup.zip \ lvm
Perform a backup using the OrientDB Console with the
CONNECT PLOCAL:../database/testdb/ admin adminpasswdorientdb>
BACKUP DATABASE /path/to/backup.zipBackup executed in 0.52 seconds.
NOTE Non-blocking backups require that the operating system support LVM. For more information, see
Once you have created your
backup.zip file, you can restore it to the database either through the OrientDB Console, using the
RESTORE DATABASE command.
RESTORE DATABASE /backups/mydb.zipRestore executed in 6.33 seconds
For more information, see