【问题标题】:Moving data between Neo4j databases在 Neo4j 数据库之间移动数据
【发布时间】:2015-11-09 22:42:35
【问题描述】:

我必须在两个 Neo4j 数据库之间移动数据。其中一个是旧的(2.1.8),新的是 2.3.0。 我尝试的是这个,但你也可以在输出中看到有问题。

/home/adam/neo4j-community-2.1.8/bin/neo4j-shell -path /home/adam/neo4j_bak9/ -c "dump" | /home/adam/neo4j-community-2.3.0/bin/neo4j-shell -file -
Transaction started
3 ms

WARNING: Invalid input 'c': expected whitespace, comment, ';' or end of input (line 2, column 1 (offset: 39))
"create index on :`Location`(`latitude`)"
 ^
ERROR (-v for expanded information):
    Transaction was marked as successful, but unable to commit transaction so rolled back.

 -host      Domain name or IP of host to connect to (default: localhost)
 -port      Port of host to connect to (default: 1337)
 -name      RMI name, i.e. rmi://<host>:<port>/<name> (default: shell)
 -pid       Process ID to connect to
 -c         Command line to execute. After executing it the shell exits
 -file      File containing commands to execute, or '-' to read from stdin. After executing it the shell exits
 -readonly  Connect in readonly mode (only for connecting with -path)
 -path      Points to a neo4j db path so that a local server can be started there
 -config    Points to a config file when starting a local server

Example arguments for remote:
    -port 1337
    -host 192.168.1.234 -port 1337 -name shell
    -host localhost -readonly
    ...or no arguments for default values
Example arguments for local:
    -path /path/to/db
    -path /path/to/db -config /path/to/neo4j.config
    -path /path/to/db -readonly

看起来 neo4j 正在生成新版本无法读取的语法。是我做错了什么还是这是一个错误?

【问题讨论】:

    标签: neo4j


    【解决方案1】:

    这是我遇到的问题。我认为 dump 顶部的 create index 语句需要分号(反之亦然)。很遗憾,那里的导入/导出并不顺畅。

    升级 Neo4j 的最简单和最干净的方法的另一种选择(假设您能够有一点停机时间):

    • 关闭两台服务器
    • graph.db 目录从旧的data 目录复制到新目录
    • 确保新数据库在conf/neo4j.properties 文件中设置了allow_store_upgrade=true
    • 启动新数据库

    当它启动时,它应该看到数据库文件来自旧版本并自动将它们升级到2.3.0格式。

    【讨论】:

    • 前段时间我创建了一个脚本,它关心下载本身并执行升级:blog.armbruster-it.de/2012/06/…
    • 我写了一个可以正确导出的 shell 扩展:github.com/jexp/neo4j-shell-tools#cypher-export
    • 将旧数据库复制到新位置并设置 allow_store_upgrade 是我的第一个想法。但是,这样做有问题。我通过 2.1.8 -> 2.2.6 -> 2.3.0 解决了这个问题。尽管如此,拥有一个简单的方法来转储数据库然后加载它而不需要额外的工具是一件好事。最初的想法看起来很有希望。遗憾的是,由于这个小问题,这是不可能的。我希望它至少兼容 2.3.0 2.3.0.
    • 有趣,我以为你可以跳过主要版本。也许这只是一些你不能的情况。很高兴它对你有用!
    猜你喜欢
    • 2023-04-07
    • 2016-11-29
    • 2011-04-23
    • 1970-01-01
    • 2018-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多