Goals This guide describes how to configure a high availability cluster of Neo4j Enterprise. It includes topics such as data synchronization, mending procedures, configuring an arbiter, and slave-only mode configuration. Prerequisites You should know how to download and install Neo4j… Learn More →
This guide describes how to configure a high availability cluster of Neo4j Enterprise. It includes topics such as data synchronization, mending procedures, configuring an arbiter, and slave-only mode configuration.
Data Synchronization between master and slaves
The Neo4j High Availability Cluster is a fault tolerant, full master-slave replication setup. Any data (graph or index) created on the master is propagated to the slaves depending on the settings of the master
ha.tx_push_factor (number of slaves to actively push to during commit) and slaves
ha.pull_interval (frequency of pulling updates from the master).
Configuring a Two-Slave Cluster with an Arbiter
There’s a step-by-step tutorial for setting up a HA cluster. For a two-node cluster, you’ll actually want to run three separate machines, and use the Neo4j arbiter on the third. Details on the arbiter are available in the Neo4j Manual. The configuration for the arbiter is identical to that of a regular instance, with the exception of anything relating to the actual graph database itself (since an arbiter doesn’t hold any data).
ha.initial_hosts property should be the same on all the instances, including the arbiter. The arbiter should have a unique
3 is fine).
Setting a Server in Slave-Only Mode
See the documentation on
You might want to configure a machine with that setting if it’s acting as a reporting instance but you need to make sure that two members don’t have that setting, or you won’t have any failover in the cluster.
Backing Up a Cluster Server
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
It is best to use the back tool with the command line
./bin/neo4j-backup -host 192.168.1.34 -to /mnt/backup/neo4j-backup, which will backup the store from that specific host even if that host is running in a cluster.
Additional details can be found in the manual.
Mending Procedure for Master
- Shut down all members of the cluster and stop any load against the cluster
- On the master instance, copy the
data/graph.dbfolder as a backup
- Modify neo4j-server.properties, setting the
- Start the database and, once it’s running, stop it again (this is to ensure he database is cleanly shut down)
- Remove all files named
data/graph.db, being careful not to remove any files without the “v”, like
- Start the server and use either neo4j-shell or the neo4j browser to issue the following two queries:
- First query. Note the id returned here
- Second query. Use the id returned from the previous query
- Stop the server
- Set org.neo4j.server.database.mode to HA
- Start the server