7.5. Restore a backup

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

This section includes:

7.5.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.

7.5.2. Restore a single database

To restore from a backup, follow these steps:

  1. If the database is running, shut it down.
  2. Run neo4j-admin restore.
  3. Start up the database.
Example 7.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

7.5.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, using neo4j-admin restore.
  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.