First of all, backups for Neo4j Enterprise need to be enabled in the neo4j.conf file:
dbms.backup.enabled=true
dbms.backup.address=192.168.0.100:6362
Performing a full backup involves running the backup command with the Neo4j admin tool:
bin/neo4j-admin backup --from=192.168.0.100 --backup-dir=/backups/ --name=astronaut.db-backup
Doing full backup...
This should create a new astronaut.db-backup file in the /backups/ directory.
The same command will invoke an incremental backup if the following conditions are met:
- The backup location exists
- All transaction logs from the time of the prior backup to the present exist
bin/neo4j-admin backup --from=192.168.0.100 --backup-dir=/backups/ --name=astronaut.db-backup --fallback-to-full=true
Destination is not empty, doing incremental backup...
Using the fallback-to-full=true option ensures that a full backup will be taken, should the incremental backup fail.
Restoring from a backup is done in a similar manner. Before restoring from a prior backup, the Neo4j instance must first be shut down:
neo4j stop
Once the instance has been shut down, the database can be restored with the following command:
bin/neo4j-admin restore -from=/backups/astronaut.db-backup --database=graph.db --force
The -force option is necessary here to ensure that the current database is overwritten in favor of the one contained in the backup. Once the restore command is completed, restart Neo4j on the instance to bring the restored database online.