Chapter 27. Backup

Table of Contents

27.1. Embedded and Server
27.2. Online Backup from Java
27.3. High Availability
27.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, an 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 than doing full backups every time but they also require that a full backup has taken place before they are executed.

The backup tool will detect whether you are trying to run a full backup or an incremental one by inspecting the target directory. 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 cluster members.

[Important]Important

As of version 1.9, backups are enabled by default. That means that the configuration parameter online_backup_enabled defaults to true and that makes the backup service available on the default port (6362). To enable the backup service on a different port use online_backup_server=:9999.