15.7. Dump and load databases

This section describes the dump and load commands of Neo4j Admin.

A Neo4j database can be dumped and loaded using the following commands:

neo4j-admin dump --database=<database> --to=<destination-path>

neo4j-admin load --from=<archive-path> --database=<database> [--force]

Limitations

Usage

Using the dump and load commands is the recommended and safe way of transferring databases between environments. These commands are capable of discerning which files need to be exported and imported and which should not.

By contrast, file system copy-and-paste of databases is not supported.

Examples

Example 15.14. Use the dump command of neo4j-admin

Dump the database called neo4j into a file called /backups/neo4j/2016-10-02.dump. The destination directory for the dump file — in this case /backups/neo4j — must exist before calling the command.

$neo4j-home> bin/neo4j-admin dump --database=neo4j --to=/backups/neo4j/2016-10-02.dump

$neo4j-home> ls /backups/neo4j

$neo4j-home> 2016-10-02.dump
Example 15.15. Use the load command of neo4j-admin

Load the backed-up database contained in the file /backups/neo4j/2016-10-02.dump into database neo4j. If you have a database running, it needs to be shutdown first. When we use the --force option, any existing database gets overwritten.

$neo4j-home> bin/neo4j-admin load --from=/backups/neo4j/2016-10-02.dump --database=neo4j --force

If using the load command to seed a Causal Cluster, you must first perform neo4j-admin unbind on each of the cluster instances. The procedure is described in Section 7.3.2, “Seed from backups”.