How to get dump from a neo4j in docker?

时光毁灭记忆、已成空白 提交于 2020-04-13 04:02:08

问题


docker run -d -v /home/data:/data --name=neo neo4j

after I run a neo4j in docker,
docker exec -it neo bash

./neo4j-admin  dump --database=graph.db --to=/home/2018.dump

it will say neo4j is running
command failed: the database is in use -- stop Neo4j and try again

but ./neo4j stop will get neo4j not running

what should i do?


回答1:


I had the same issue before, so I wrote this workaround to dump neo4j data and pull it outside the container to the host machine.

docker rm --force neo4j-dump

docker run \
--name neo4j-dump \
--env-file /storage/bin/.neo4j.env \
--mount type=bind,source=<neo4j_data_folder>,target=/data \
neo4j bin/neo4j-admin dump --database=graph.db --to=/graph.db.dump

docker cp `docker ps -aqf "name=neo4j-dump"`:/graph.db.dump <target_dump_file>

docker rm --force neo4j-dump

This will create a new container and dump data instead of starting neo4j service, then copy the dump to the host, just update and to yours



来源:https://stackoverflow.com/questions/51551059/how-to-get-dump-from-a-neo4j-in-docker

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!