当前位置: 首页 > docker, 云计算 > 正文

Docker下如何导入导出neo4j数据

[摘要] 运行在Docker容器中的neo4j数据库,如何使用 neo4j-admin restore|dump 进行导入导出操作?

neo4j 官方文档有说明,使用 neo4j-admin restore / dump 导出和恢复数据库的时候需要停掉数据,否则会报数据库正在使用的错误:
command failed: the database is in use — stop Neo4j and try again

官方文档这样说:
Restore the database graph.db from the backup located in /mnt/backup/graph.db-backup. Note that the database to be restored must be shut down.

但是问题来了,容器里面entrypoint默认是启动的neo4j的进程:

现在进入容器shudown的话,neo4j容器会停掉(docker-run)或者重启数据库(docker-compose),所以这里采用的迂回的方法:

(1)停掉neo4j容器

(2)使用docker run启动一个带有TTY新的容器,如果使用了数据持久化,需要使用-v参数带上volume

(3)导入或者导出数据库

(4)关闭临时容器,重启原容器

本文固定链接: https://www.sudops.com/how-to-dump-restore-neo4j-database-in-docker.html | 运维·速度

该日志由 Fisher 于2019年01月11日发表在 docker, 云计算 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: Docker下如何导入导出neo4j数据 | 运维·速度
关键字: ,

Docker下如何导入导出neo4j数据:等您坐沙发呢!

发表评论


Time limit is exhausted. Please reload the CAPTCHA.

快捷键:Ctrl+Enter