Backup and restore

For this part, we refer you first to chapter 7 of the pdf documentation (or online). It is your responsibility to save and test the backup of the Neo4j database. In the case of a cluster, each server contains a complete copy of the database, so only one server member of this cluster should be backed up.

Among the backup modes allowed by Neo4j, it is recommended to use the online backup which is performed on a live Neo4j instance. In this mode, the backup can be complete or incremental thanks to the transaction logs.

Configuration

Backup is enabled by default. The listening address can be changed for backups. These parameters can be adjusted in the configuration file neo4j.conf.

To enable backup from a remote machine, you must change the address for example to "192.168.20.11:6362" to listen only on the interface with this address or to "0.0.0.0:6362" to listen to all Neo4j server interfaces.

In addition, you can enable SSL for backups with the setting dbms.backup.ssl_policy.

Make a backup

See section 7.4 of the pdf documentation (or online).

Example : Make a backup of the Neo4j database with the address ip "192.168.1.20" and to name it "backup-neo01-graph.db".

mkdir $HOME/neo4j-backup
bin/neo4j-admin backup --from=192.168.1.20 --backup-dir=$HOME/neo4j-backup --name=backup-neo01-graph.db

Remarks:

Restore a backup

See section 7.5 of the pdf documentation (or online).

Example: restore a backup to the new Neo4j database named "graph-restore.db".

# you need to shutdown neo4j before restoring
systemctl stop neo4j.service

# restore command
neo4j-admin restore --from=/$HOME/backup/backup-neo01-graph.db --database=graph-restore.db