知识库

Neo4j 3.0 企业版逐步升级 - Linux

Neo4j 3.0 是一个主要版本,包括目录结构重组和配置文件/参数名称的全面修改。这意味着升级到它需要一些额外的考虑和几个额外的步骤。为了为您提供尽可能最佳的升级体验,让我们逐步了解在每个我们支持的操作系统平台上的升级过程。

在此示例中,我们假设单个实例。对于集群升级,请参考相同的步骤,并结合产品文档中提到的其他步骤。

使用 tar.gz 分发版进行 Linux 升级

假设

  • Neo4j 2.3.7 已安装在 /var/lib/neo4j/neo4j-enterprise-2.3.7

  • Neo4j 2.3.7 由 neo4j 操作系统用户安装、配置和管理

步骤

  1. 导航到 NEO4J_HOME 目录

    $ cd /var/lib/neo4j/
  2. 获取 3.0 软件

    $ wget http://www.neo4j.com/customer/download/neo4j-enterprise-3.0.4-unix.tar.gz
  3. 备份现有的 Neo4j 2.3.7 安装

    $ ./neo4j-enterprise-2.3.7/bin/neo4j-backup -to /tmp/neo4j_2.3.7_backup -host 127.0.0.1
  4. 解压 3.0 软件

    $ tar -xzf neo4j-enterprise-3.0.4-unix.tar.gz
  5. 更改 3.0 目录的所有者

    $ chown -R neo4j:neo4j ./neo4j-enterprise-3.0.4
  6. 停止 Neo4j 2.3.7 服务器

    $ ./neo4j-enterprise-2.3.7/bin/neo4j stop
  7. 移动到 Neo4j 3.0 主目录

    $ cd neo4j-enterprise-3.0.4
  8. 使用新的配置迁移工具将配置从 Neo4j 2.3.7 安装迁移到新的 Neo4j 3.0

    $ java -jar config-migrator.jar /var/lib/neo4j/neo4j-enterprise-2.3.7 .
  9. 使用 neo4j-admin 将数据存储从其 2.3.7 位置迁移到 3.0

    $ ./bin/neo4j-admin import --mode=database --database=graph.db --from=/var/lib/neo4j/neo4j-enterprise-2.3.7/data/graph.db
    $ ls data/databases/
    graph.db
  10. 编辑 conf/neo4j.conf 文件,并

    1. 取消注释以下行:dbms.allow_format_migration=true

    2. 取消注释以下行:dbms.active_database=graph.db 注意:如果数据库名称不是 graph.db,请将其更改为数据库名称

  11. 将身份验证详细信息从 2.3.7 安装复制到 3.0(如果启用了身份验证)

    $ cp -R /var/lib/neo4j/neo4j-enterprise-2.3.7/conf/ssl ./conf/ssl
  12. 将插件从 2.3.7 安装复制到 3.0(如果存在任何插件)

    $ cp /var/lib/neo4j/neo4j-enterprise-2.3.7/plugins/* ./plugins
  13. 启动 Neo4j:./bin/neo4j start./bin/neo4j console

    $ ./bin/neo4j start
    Starting Neo4j.
    Started neo4j (pid 39823). By default, it is available at http://localhost:7474/
    There may be a short delay until the server is ready.
    See /var/lib/neo4j/neo4j-enterprise-3.0.4/logs/neo4j.log for current status.
  14. 跟踪 neo4j.log 以查看存储升级的进度,并确保数据库联机

    2016-04-15 19:58:20.310+0000 INFO  Starting...
    2016-04-15 19:58:21.568+0000 INFO  Initiating metrics...
    2016-04-15 19:58:21.898+0000 INFO  Starting upgrade of database
    2016-04-15 19:58:21.939+0000 INFO  Migrating Indexes (1/3):
    2016-04-15 19:58:21.946+0000 INFO    10% completed
    2016-04-15 19:58:21.946+0000 INFO    20% completed
    2016-04-15 19:58:21.951+0000 INFO    30% completed
    2016-04-15 19:58:21.951+0000 INFO    40% completed
    2016-04-15 19:58:21.951+0000 INFO    50% completed
    2016-04-15 19:58:21.951+0000 INFO    60% completed
    2016-04-15 19:58:21.951+0000 INFO    70% completed
    2016-04-15 19:58:21.951+0000 INFO    80% completed
    2016-04-15 19:58:21.951+0000 INFO    90% completed
    2016-04-15 19:58:21.952+0000 INFO    100% completed
    2016-04-15 19:58:21.952+0000 INFO  Migrating Legacy indexes (2/3):
    2016-04-15 19:58:21.997+0000 INFO    10% completed
    2016-04-15 19:58:21.998+0000 INFO    20% completed
    2016-04-15 19:58:21.999+0000 INFO    30% completed
    2016-04-15 19:58:21.999+0000 INFO    40% completed
    2016-04-15 19:58:21.999+0000 INFO    50% completed
    2016-04-15 19:58:22.000+0000 INFO    60% completed
    2016-04-15 19:58:22.000+0000 INFO    70% completed
    2016-04-15 19:58:22.000+0000 INFO    80% completed
    2016-04-15 19:58:22.001+0000 INFO    90% completed
    2016-04-15 19:58:22.002+0000 INFO    100% completed
    2016-04-15 19:58:22.002+0000 INFO  Migrating Store files (3/3):
    2016-04-15 19:58:22.727+0000 INFO  Initiating metrics...
    2016-04-15 19:58:23.552+0000 INFO    10% completed
    2016-04-15 19:58:23.553+0000 INFO    20% completed
    2016-04-15 19:58:23.553+0000 INFO    30% completed
    2016-04-15 19:58:23.553+0000 INFO    40% completed
    2016-04-15 19:58:23.553+0000 INFO    50% completed
    2016-04-15 19:58:23.553+0000 INFO    60% completed
    2016-04-15 19:58:23.553+0000 INFO    70% completed
    2016-04-15 19:58:23.554+0000 INFO    80% completed
    2016-04-15 19:58:23.554+0000 INFO    90% completed
    2016-04-15 19:58:23.554+0000 INFO    100% completed
    2016-04-15 19:58:23.682+0000 INFO  Successfully finished upgrade of database
    2016-04-15 19:58:28.447+0000 INFO  Started.
    2016-04-15 19:58:28.844+0000 INFO  Mounted REST API at: /db/manage
    2016-04-15 19:58:30.920+0000 INFO  Remote interface available at http://localhost:7474/

使用 Debian (apt-get) 进行 Linux 升级

假设

  • 您熟悉 http://debian.neo4j.org/ 上的说明

  • Neo4j Enterprise 2.3.7(或其他 2.x 版本)已通过 Debian 软件包安装

步骤

  1. 使用 apt-get 更新

    $ sudo apt-get update
  2. 安装 neo4j-enterprise=3.0.4

    $ sudo apt-get install neo4j-enterprise=3.0.4
  3. 出现提示时,选择选项 N,因为我们稍后会解决此问题

    Configuration file '/etc/neo4j/neo4j-wrapper.conf'
     ==> Modified (by you or by a script) since installation.
     ==> Package distributor has shipped an updated version.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions
          Z     : start a shell to examine the situation
     The default action is to keep your current version.
    *** neo4j-wrapper.conf (Y/I/N/O/D/Z) [default=N] ?  N
  4. 停止 neo4j

    $ service neo4j stop
  5. 运行 Neo4j 3.0 附带的 config-migrator.jar 实用程序

    $sudo java -jar /usr/share/neo4j/bin/tools/config-migrator.jar /var/lib/neo4j/ .
  6. 将新的配置文件复制到 /etc/conf,并将旧文件移出,或者在确认新生成的配置文件正确后将其删除

    $ mkdir /etc/neo4j_archive
    $ mv /etc/neo4j/* /etc/neo4j_archive/
    $ cp /var/lib/neo4j/conf/* /etc/neo4j
  7. 如果适用,复制身份验证(需要实际测试)

  8. 使用 allow_format_migration 设置为 true 更新 /etc/neo4j/neo4j.conf,以及任何其他必需的设置。

  9. 启动数据库

    $ service neo4j start

Debian 安装后文件所在位置

/var/lib/neo4j

数据、证书

/var/log/neo4j

日志

/usr/share/neo4j/

bin、lib、tools

/etc/neo4j

配置文件