mysql - 使用 Neo4j ETL CLI 工具从 MySQL 数据库加载时出现问题

标签 mysql neo4j graph-databases

我正在尝试使用以下工具将数据从 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 数据库都位于我从 (localhost) 执行的服务器上。我尝试在 MySQL 中创建另一个用户(我也为其授予了所有权限),但是在执行命令时,我收到了相同的错误。

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

最佳答案

终于明白我哪里错了。我为导入工具指定了错误的路径,并且在连接 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 }]

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

关于mysql - 使用 Neo4j ETL CLI 工具从 MySQL 数据库加载时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57860971/

相关文章:

java - Neo4j 在 IntelliJ IDEA 的 JUnit 测试中运行时登录服务器扩展

Neo4j 具有最高聚合关系属性的最短路径

java - 将 Neo4j 密码查询转换为 orientdb/gremlin(在 java 中)

c# - 在 C# 中使用 Neo4JClient 为 Neo4J 定义架构

mysql - 可以在 MySQL NDB Cluster 中使用联合表

java - Spring boot 无法从数据源(mysql)确定 jdbc url

mysql查询获取重复记录对应的数据

Windows 中的 mysql.exe 输出 CSV 文件

azure - 如何使用 Gremlin API 在 Azure Cosmos DB 中创建元图

neo4j - 如何在Neo4j中获取所有连接的节点