迁移 Neo4j 配置文件

您可以使用 migrate-configuration 命令将旧版 Neo4j 配置文件迁移到当前格式。新版本将写入目标配置目录。源配置目录和目标配置目录的默认位置是 NEO_CONF 指定的配置目录或此安装的默认配置目录。如果源目录和目标目录相同,则原始配置文件将被重命名。使用 --additional-config 选项提供的配置不会被迁移。

为什么要使用此命令?
  • 配置迁移是一个纯粹的机械过程,使用 migrate-configuration 命令进行显式迁移使您可以检查和自定义输出。

  • 该命令的输出提供了有关迁移过程的有价值的见解,包括有关无法有意义地迁移的设置的通知,例如,因为该概念或行为在 DBMS 的新 MAJOR 版本中不再存在。

语法

neo4j-admin server migrate-configuration 命令具有以下语法

neo4j-admin server migrate-configuration [-h] [--expand-commands]
                                         [--verbose] [--from-path=<path>]
                                         [--to-path=<path>]

选项

neo4j-admin server migrate-configuration 命令具有以下选项

表 1. neo4j-admin server migrate-configuration 选项
选项 描述

--expand-commands

允许在配置值评估中进行命令扩展。

--from-path=<path>

用作迁移来源的配置目录的路径。

-h, --help

显示此帮助消息并退出。

--to-path=<path>

应写入迁移配置文件的目录的路径。

--verbose

启用详细输出。

示例

以下示例展示如何将旧版配置文件迁移到当前格式。

bin/neo4j-admin server migrate-configuration --from-path=/path/to/legacy/neo4j-enterprise-4.4.10/conf/ --to-path=/path/to/new/neo4j-enterprise-5.25.1/conf/
示例输出
Keeping original user-logs.xml file at: /neo4j-enterprise-5.1.0/conf/user-logs.xml.old
User logging configuration xml file generated: /neo4j-enterprise-5.1.0/conf/user-logs.xml
Keeping original server-logs.xml file at: /neo4j-enterprise-5.1.0/conf/server-logs.xml.old
Server logging configuration xml file generated: /neo4j-enterprise-5.1.0/conf/server-logs.xml
dbms.directories.import=import MIGRATED -> server.directories.import=import
dbms.tx_state.memory_allocation=ON_HEAP MIGRATED -> db.tx_state.memory_allocation=ON_HEAP
dbms.connector.bolt.enabled=true MIGRATED -> server.bolt.enabled=true
dbms.connector.http.enabled=true MIGRATED -> server.http.enabled=true
dbms.connector.https.enabled=false MIGRATED -> server.https.enabled=false
metrics.csv.rotation.compression=zip MIGRATED -> server.metrics.csv.rotation.compression=zip
dbms.jvm.additional=-XX:+UseG1GC MIGRATED -> server.jvm.additional=-XX:+UseG1GC
dbms.jvm.additional=-XX:-OmitStackTraceInFastThrow MIGRATED -> server.jvm.additional=-XX:-OmitStackTraceInFastThrow
dbms.jvm.additional=-XX:+AlwaysPreTouch MIGRATED -> server.jvm.additional=-XX:+AlwaysPreTouch
dbms.jvm.additional=-XX:+UnlockExperimentalVMOptions MIGRATED -> server.jvm.additional=-XX:+UnlockExperimentalVMOptions
dbms.jvm.additional=-XX:+TrustFinalNonStaticFields MIGRATED -> server.jvm.additional=-XX:+TrustFinalNonStaticFields
dbms.jvm.additional=-XX:+DisableExplicitGC MIGRATED -> server.jvm.additional=-XX:+DisableExplicitGC
dbms.jvm.additional=-XX:MaxInlineLevel=15 MIGRATED -> server.jvm.additional=-XX:MaxInlineLevel=15
dbms.jvm.additional=-XX:-UseBiasedLocking MIGRATED -> server.jvm.additional=-XX:-UseBiasedLocking
dbms.jvm.additional=-Djdk.nio.maxCachedBufferSize=262144 MIGRATED -> server.jvm.additional=-Djdk.nio.maxCachedBufferSize=262144
dbms.jvm.additional=-Dio.netty.tryReflectionSetAccessible=true MIGRATED -> server.jvm.additional=-Dio.netty.tryReflectionSetAccessible=true
dbms.jvm.additional=-Djdk.tls.ephemeralDHKeySize=2048 MIGRATED -> server.jvm.additional=-Djdk.tls.ephemeralDHKeySize=2048
dbms.jvm.additional=-Djdk.tls.rejectClientInitiatedRenegotiation=true MIGRATED -> server.jvm.additional=-Djdk.tls.rejectClientInitiatedRenegotiation=true
dbms.jvm.additional=-XX:FlightRecorderOptions=stackdepth=256 MIGRATED -> server.jvm.additional=-XX:FlightRecorderOptions=stackdepth=256
dbms.jvm.additional=-XX:+UnlockDiagnosticVMOptions MIGRATED -> server.jvm.additional=-XX:+UnlockDiagnosticVMOptions
dbms.jvm.additional=-XX:+DebugNonSafepoints MIGRATED -> server.jvm.additional=-XX:+DebugNonSafepoints
dbms.jvm.additional=-Dlog4j2.disable.jmx=true MIGRATED -> server.jvm.additional=-Dlog4j2.disable.jmx=true
dbms.windows_service_name=neo4j MIGRATED -> server.windows_service_name=neo4j
Keeping original configuration file at: /neo4j-enterprise-5.1.0/conf/neo4j.conf.old

示例输出不应用于填充新的 Neo4j 5 neo4j.conf 文件。

可以在 /path/to/new/neo4j-enterprise-5.25.1/conf/ 中找到 5.x 语法正确的配置文件,其中 /path/to/new/neo4j-enterprise-5.25.1/conf/--to-path= 的值。