首页 > 解决方案 > 使用 Neo4j ETL CLI 工具从 MySQL 数据库加载的问题

问题描述

我正在尝试使用以下工具将数据从 MySQL(MariaDB,技术上)数据库加载到 Neo4j(两者都在同一 Centos 7 Linux 机器上运行)。

https://github.com/neo4j-contrib/neo4j-etl

我已经下载了它,并且我在 MySQL 数据库上拥有了一个 root 用户,该用户具有跨所有数据库/模式授予的权限。

因为我使用的是 MySQL,所以不需要手动加载和配置 JDBC(根据上面的链接,它是内置在最新版本的 Neo4j-ETL 软件中的)。

我正在执行以下命令来尝试运行可执行文件(作为 root 用户):

./neo4j-etl export --rdbms:url jdbc:mysql://localhost:3306 --rdbms:user root --rdbms:password password --destination /var/lib/neo4j/data/new_databases/graph.db --import-tool /usr/bin/ --csv-directory /var/lib/neo4j/import --debug

此命令会产生以下消息:

INFO: Skipping reading import options from file because file [] doesn't exist.
FINE: Connecting to database...
SEVERE: Could not connect to the host database. Please check your credentials
java.sql.SQLException: The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure                                                                                                            either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want                                                                                                            to utilize time zone support.
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
      at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
      at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
      at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
      at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
      at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
      at java.sql.DriverManager.getConnection(DriverManager.java:664)
      at java.sql.DriverManager.getConnection(DriverManager.java:247)
      at org.neo4j.etl.sql.DatabaseClient.<init>(DatabaseClient.java:65)
      at org.neo4j.etl.cli.rdbms.ImportFromRdbmsCli.run(ImportFromRdbmsCli.java:134)
      at org.neo4j.etl.util.CliRunner.run(CliRunner.java:42)
      at org.neo4j.etl.util.CliRunner.run(CliRunner.java:35)
      at org.neo4j.etl.NeoIntegrationCli.main(NeoIntegrationCli.java:43)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'EDT' is unrecognized or repres                                                                                                           ents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property)                                                                                                            to use a more specifc time zone value if you want to utilize time zone support.
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
      at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
      at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
      at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234)
      at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258)
      at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
      at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)
      at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
      ... 10 more

java.sql.SQLException: The server time zone value 'EDT' is unrecognized or represents more than one time zone. You must configure                                                                                                            either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want                                                                                                            to utilize time zone support.
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
      at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76)
      at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
      at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
      at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
      at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
      at java.sql.DriverManager.getConnection(DriverManager.java:664)
      at java.sql.DriverManager.getConnection(DriverManager.java:247)
      at org.neo4j.etl.sql.DatabaseClient.<init>(DatabaseClient.java:65)
      at org.neo4j.etl.cli.rdbms.ImportFromRdbmsCli.run(ImportFromRdbmsCli.java:134)
      at org.neo4j.etl.util.CliRunner.run(CliRunner.java:42)
      at org.neo4j.etl.util.CliRunner.run(CliRunner.java:35)
      at org.neo4j.etl.NeoIntegrationCli.main(NeoIntegrationCli.java:43)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'EDT' is unrecognized or repres                                                                                                           ents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property)                                                                                                            to use a more specifc time zone value if you want to utilize time zone support.
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
      at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
      at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
      at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2234)
      at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2258)
      at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
      at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:966)
      at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
      ... 10 more
It seems 'java' command is not available.
Please check your JAVA_HOME environment variable.
Also check if you have a valid Java 8 environment

当我运行“java -version”时,我得到以下信息,这让我相信我的 java 没问题,尽管有错误消息:

[root@NEO42 bin]# java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)

Neo4j 数据库和 MySQL 数据库都位于我从(本地主机)执行的服务器上。我尝试在 MySQL 中创建另一个用户(我也授予了所有权限),但是在执行命令时,我收到了同样的错误。

有人对我的问题可能在这里有任何想法吗?任何提示、建议或指示将不胜感激。

标签: mysqlneo4jgraph-databases

解决方案


弄清楚我哪里出错了。我为导入工具指定了错误的路径,在连接 URL 中,我需要指定提取和导入请求的数据库,还需要指定时区。查看以下命令以了解更改:

./neo4j-etl export --rdbms:url jdbc:mysql://localhost:3306/db?serverTimezone=EST --rdbms:user root --rdbms:password password --destination /var/lib/neo4j/data/new_databases/graph.db --import-tool /usr/share/neo4j/bin/ --csv-directory /var/lib/neo4j/import --debug

不幸的是,虽然这主要回答了我的问题,但还有另一个问题,似乎可能是版本不兼容问题,特别是我看到的错误如下:

Input error: Missing argument 'into'
Caused by:Missing argument 'into'
java.lang.IllegalArgumentException: Missing argument 'into'
    at org.neo4j.kernel.impl.util.Converters.lambda$mandatory$0(Converters.java:43)
    at org.neo4j.helpers.Args.interpretOption(Args.java:542)
    at org.neo4j.tooling.ImportTool.main(ImportTool.java:408)
    at org.neo4j.tooling.ImportTool.main(ImportTool.java:360)
', DurationMillis: 322 }]

我将为这个问题创建另一个问题,以将提问领域集中在我的问题上。


推荐阅读