6.3. Restore a backup

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

6.3.1. Restore commands

A Neo4j database can be restored using the restore command of neo4j-admin.

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. Run the neo4j-admin unbind command on each of the Core Servers.
  3. Restore the backup on each instance, following the instructions in Restore a single database.
  4. If you are restoring onto new hardware, please review the Causal Clustering settings in neo4j.conf.

    In particular, check the settings causal_clustering.initial_discovery_members, causal_clustering.minimum_core_cluster_size_at_formation, and causal_clustering.minimum_core_cluster_size_at_runtime, and ensure that they correctly reflect the new setup.

  5. 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 ha.initial_hosts setting to ensure that the servers listed reflect the servers on which the restores are being made.

  4. Start the database instances, beginning with the master.