Chapter 23. Backup

Table of Contents

23.1. Embedded and Server
23.2. Online Backup from Java
23.3. High Availability
23.4. Restoring Your Data
[Note]Note

The Backup features are only available in the Neo4j Enterprise Edition.

Backups are performed over the network live from a running graph database onto a local copy. There are two types of backup: full and incremental.

A full backup copies the database files without acquiring any locks, allowing for continued operations on the target instance. This of course means that while copying, transactions will continue and the store will change. For this reason, the transaction that was running when the backup operation started is noted and, when the copy operation completes, all transactions from the latter down to the one happening at the end of the copy are replayed on the backup files. This ensures that the backed up data represent a consistent and up-to-date snapshot of the database storage.

In contrast, incremental backup does not copy store files - instead it copies the logs of the transactions that have taken place since the last full or incremental backup which are then replayed over an existing backup store. This makes incremental backups far more efficient that doing full backups every time but they also require that a full backup has taken place before they are executed.

Regardless of the mode a backup is created with, the resulting files represent a consistent database snapshot and they can be used to boot up a Neo4j instance.

The database to be backed up is specified using a URI with syntax

<running mode>://<host>[:port]{,<host>[:port]*}

Running mode must be defined and is either single for non-HA or ha for HA clusters. The <host>[:port] part points to a host running the database, on port port if not the default. The additional host:port arguments are useful for passing multiple coordinator instances

[Important]Important

Backups can only be performed on databases which have the configuration parameter enable_online_backup=true set. That will make the backup service available on the default port (6362). To enable the backup service on a different port use for example enable_online_backup=port=9999 instead.