neo4j 不同实例之间数据的export和import

本文详细介绍了如何利用APOC插件在Neo4j数据库中实现数据的导出与导入操作。首先,需要在导出侧启用APOC插件并设置相关配置,然后通过Cypher查询语句将数据库内容导出到指定文件。接着,通过合并导出的文件,可以创建一个完整的目标Cypher文件。在导入侧,同样需要启用APOC插件,并通过命令行工具cypher-shell将目标Cypher文件的内容导入到数据库中。这一过程不关心节点和关系的重复,适用于需要合并两个数据库场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

consider to use APOC. Here is how to use.

[on export side]

  1. enable APOC(Neo4j Desktop is easy to enable)
  2. set "apoc.export.file.enabled=true" into your database config
  3. (re)start database
  4. open Neo4j browser
  5. call "CALL apoc.export.cypherAll('/usr/tmp/test1.cypher', {format:'plain'})"

merge exported files like this

cat test1.cypher test2.cypher > target.cypher

[on import side]

  1. enable APOC
  2. set "apoc.import.file.enabled=true" into your database config
  3. start database
  4. open terminal
  5. run command
cat /usr/tmp/target.cypher | bin/cypher-shell -u yourusername -p yourpassword

This procedure doesn't care about duplicated nodes and relationships. I hope this may helps.

 

Referneces:

original dock: https://community.neo4j.com/t/how-to-merge-two-databases/4835/2

export, import using apoc: https://neo4j-contrib.github.io/neo4j-apoc-procedures/#export-csv

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值