如何从docker中的neo4j获取转储? [英] How to get dump from a neo4j in docker?
本文介绍了如何从docker中的neo4j获取转储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
docker run -d -v /home/data:/data --name=neo neo4j
在docker中运行neo4j之后,
docker exec -it neo bash
after I run a neo4j in docker,
docker exec -it neo bash
./neo4j-admin dump --database=graph.db --to=/home/2018.dump
它将说neo4j正在运行
command failed: the database is in use -- stop Neo4j and try again
it will say neo4j is running
command failed: the database is in use -- stop Neo4j and try again
,但./neo4j stop
将获得neo4j not running
我该怎么办?
推荐答案
我之前也遇到过同样的问题,所以我写了这个变通办法来转储neo4j数据并将其从容器中拉到主机上.
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
这将创建一个新的容器并转储数据,而不是启动neo4j服务,然后将转储复制到主机, 只需更新并更新到您的
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
这篇关于如何从docker中的neo4j获取转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文