6.3. Restore a backup

This section describes how to restore from a backup of a Neo4j database.

6.3.1. Restore commands

The neo4j-admin tool is located in the bin directory. Run it with the restore argument in order to restore a backup.

Syntax

neo4j-admin restore --from=<backup-directory> [--database=<name>] [--force[=<true|false>]]

Options

Option Default Description

--from

 

Path to backup to restore from.

--database

graph.db

Name of database.

--force

false

If an existing database should be replaced.

6.3.2. Restore a single database

Example 6.3. Restore a single database

Restore the database graph.db from the backup located in /mnt/backup/graph.db-backup. Note that the database to be restored must be shut down.

neo4j-home> bin/neo4j stop
neo4j-home> bin/neo4j-admin restore --from=/mnt/backup/graph.db-backup --database=graph.db --force
neo4j-home> bin/neo4j start

6.3.3. Restore a Causal Cluster

To restore from a backup in a Causal Cluster, follow these steps:

  1. Shut down all database instances in the cluster.
  2. Restore the backup on each instance, following the instructions in Restore a single database.
  3. If you are restoring onto new hardware, please review the Causal Clustering settings in neo4j.conf. In particular, check the setting causal_clustering.initial_discovery_members to ensure that the servers listed there are reflecting the servers on which the restores are being made, and the setting causal_clustering.expected_core_cluster_size to reflect the number of servers in the new configuration.
  4. Start the database instances.

6.3.4. Restore an HA cluster

To restore from backup in an HA cluster environment, follow these steps:

  1. Shut down all database instances in the cluster.
  2. Restore the backup on each instance, following the instructions in Restore a single database.
  3. If you are restoring onto new hardware, please review the HA settings in neo4j.conf. In particular, check the setting ha.initial_hosts to ensure that the servers listed there are reflecting the servers on which the restores are being made.
  4. Start the database instances. Begin with the master.