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
dump
and load
commands.
neo4j-admin
must be invoked as the neo4j
user in order to ensure the appropriate file permissions.
Examples of usage
Moving databases from one environment to another.
Using the dump
and load
commands is the recommended, and safe, way of transferring databases between environments.
They understand which files need to be exported and imported and which should not.
By contrast, file system copy-and-paste of databases is not supported.
Offline backups.
For a discussion of online versus offline backups, see Section 7.1.2, “Online and offline backups”.
Examples
dump
command of neo4j-admin
Dump the database called graph.db
into a file called /backups/graph.db/2016-10-02.dump
.
The destination directory for the dump file — in this case /backups/graph.db — must exist before calling the command.
$neo4j-home> bin/neo4j-admin dump --database=graph.db --to=/backups/graph.db/2016-10-02.dump
$neo4j-home> ls /backups/graph.db
$neo4j-home> 2016-10-02.dump
load
command of neo4j-admin
Load the backed-up database contained in the file /backups/graph.db/2016-10-02.dump
into database graph.db
.
Since we have a database running, we first have to shut it down.
When we use the --force
option, any existing database gets overwritten.
$neo4j-home> bin/neo4j stop
Stopping Neo4j.. stopped
$neo4j-home> bin/neo4j-admin load --from=/backups/graph.db/2016-10-02.dump --database=graph.db --force
If using the |