24.1. Introducing Backup

Backups are performed over the network, from a running Neo4j server and into a local copy of the database store (the backup). The backup is run using the neo4j-backup tool, which is provided alongside Neo4j Enterprise.

[Important]Important

Neo4j Server must be configured to run a backup service. This is enabled via the configuration parameter online_backup_enabled, and is enabled by default. The interface and port the backup service listens on is configured via the parameter online_backup_server and defaults to the loopback interface and port 6362. It is typical to reconfigure this to listen on an external interface, by setting online_backup_server=<my-host-ip-address>:6362. It can also be configured to listen on all interfaces by setting online_backup_server=0.0.0.0:6362.

Performing a backup requires specifying the target host, an optional port, and the backup location. The backup tool will automatically select a full or incremental backup, based on whether an existing backup is present at that location.

# Performing a full backup: create a blank directory and run the backup tool
mkdir /mnt/backup/neo4j-backup
./bin/neo4j-backup -host 192.168.1.34 -to /mnt/backup/neo4j-backup

# Performing an incremental backup: just specify the location of your previous backup
./bin/neo4j-backup -host 192.168.1.34 -to /mnt/backup/neo4j-backup

# Performing an incremental backup where the service is listening on a non-default port
./bin/neo4j-backup -host 192.168.1.34 -port 9999 -to /mnt/backup/neo4j-backup

Incremental Backups

An incremental backup is performed whenever an existing backup directory is specified. The backup tool will then copy any new transactions from the Neo4j server and apply them to the backup. The result will be an updated backup that is consistent with the current server state.

However, the incremental backup may fail for a number of reasons:

  • If the existing directory doesn’t contain a valid backup.
  • If the existing directory contains a backup of a different database store.
  • If the existing directory contains a backup from a previous database version.
[Note]Note

Note that when copying the outstanding transactions, the backup tool needs access to the historical logical logs. These logical logs are kept by Neo4j and automatically removed after a period of time, based on the keep_logical_logs configuration. If the required logical logs have already been removed, the backup tool will do a full backup instead.