是否有工具将Neo4j图转储为Cypher并从Cypher重新加载?

时间:2021-10-18 18:07:10

Everyone familiar with MySQL has likely used the mysqldump command which can generate a file of SQL statements representing both the schema and data in a MySQL database. These SQL text files are commonly used for many purposes: backups, seeding replicas, copying databases between installations (- copy prod DBs to staging environments etc) and others.

熟悉MySQL的每个人都可能使用mysqldump命令,该命令可以生成表示MySQL数据库中的模式和数据的SQL语句文件。这些SQL文本文件通常用于多种用途:备份,种子复制,在安装之间复制数据库( - 将prod DB复制到登台环境等)和其他目的。

Is there a similar tool for Neo4j that can dump an entire graph into a text file of Cypher statements, that when executed on an empty database would reconstruct the original data?

Neo4j是否有类似的工具可以将整个图形转储到Cypher语句的文本文件中,当在空数据库上执行时会重建原始数据?

Thanks.

2 个解决方案

#1


15  

In neo4j version 2 (e.g. 2.0.0M3), using neo4j-shell, you can use the command

在neo4j版本2(例如2.0.0M3)中,使用neo4j-shell,您可以使用该命令

dump

which will create the cypher statements (pretty much like mysqldump would do. To read in the file you can use

这将创建cypher语句(非常像mysqldump会做的。要读入文件,你可以使用

cat dump.cql | neo4j-shell

cat dump.cql | Neo4j的壳

#2


5  

Cypher is just a query language for Neo4J just as SQL is for MySQL or other relational databases. If you wish to transfer the db, then you just need to copy the folder containing the database files. Simple.

Cypher只是Neo4J的查询语言,就像SQL用于MySQL或其他关系数据库一样。如果要传输数据库,则只需复制包含数据库文件的文件夹即可。简单。

For example my folder simple-graph contains all the db files. Just copy the folder and store it at some other location. You can directly start using it as:

例如,我的文件夹simple-graph包含所有db文件。只需复制文件夹并将其存储在其他位置即可。您可以直接开始使用它:

GraphDatabaseServiceraphDb = new EmbeddedGraphDatabase(DB_PATH);//DB_PATH is path to the new location

#1


15  

In neo4j version 2 (e.g. 2.0.0M3), using neo4j-shell, you can use the command

在neo4j版本2(例如2.0.0M3)中,使用neo4j-shell,您可以使用该命令

dump

which will create the cypher statements (pretty much like mysqldump would do. To read in the file you can use

这将创建cypher语句(非常像mysqldump会做的。要读入文件,你可以使用

cat dump.cql | neo4j-shell

cat dump.cql | Neo4j的壳

#2


5  

Cypher is just a query language for Neo4J just as SQL is for MySQL or other relational databases. If you wish to transfer the db, then you just need to copy the folder containing the database files. Simple.

Cypher只是Neo4J的查询语言,就像SQL用于MySQL或其他关系数据库一样。如果要传输数据库,则只需复制包含数据库文件的文件夹即可。简单。

For example my folder simple-graph contains all the db files. Just copy the folder and store it at some other location. You can directly start using it as:

例如,我的文件夹simple-graph包含所有db文件。只需复制文件夹并将其存储在其他位置即可。您可以直接开始使用它:

GraphDatabaseServiceraphDb = new EmbeddedGraphDatabase(DB_PATH);//DB_PATH is path to the new location