Dump and load a Neo4j database (offline)
The neo4j-admin database dump
and neo4j-admin database load
commands can be run locally to dump and load an offline database.
The following are examples of how to dump and load the default neo4j
database.
Because these commands are run on a stopped database, you have to launch a container for each operation (dump and load), with the --rm
flag.
Example 1. Invoke
neo4j-admin database dump
to dump your database.docker run --interactive --tty --rm \
--volume=$HOME/neo4j/data:/data \ (1)
--volume=$HOME/neo4j/backups:/backups \ (2)
neo4j/neo4j-admin:5.26.0 \
neo4j-admin database dump neo4j --to-path=/backups
1 | The volume that contains the database that you want to dump. |
2 | The volume that will be used for the dumped database. |
Example 2. Invoke
neo4j-admin database load
to load your data into the new database.docker run --interactive --tty --rm \
--volume=$HOME/neo4j/newdata:/data \ (1)
--volume=$HOME/neo4j/backups:/backups \ (2)
neo4j/neo4j-admin:5.26.0 \
neo4j-admin database load neo4j --from-path=/backups
1 | The volume that will contain the database, into which you want to load the dumped data. |
2 | The volume that stores the database dump. |
Finally, you launch a container with the volume that contains the newly loaded database, and start using it.
Launching a container from restored data
docker run --interactive --tty --rm \
--volume=$HOME/neo4j/newdata:/data \ (1)
neo4j:5.26.0
1 | The volume containing the restored data |
For more information on the neo4j-admin database dump and load syntax and options, see neo4j-admin database dump and neo4j-admin database load .For more information on managing volumes, see the official Docker documentation. |