apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
https://hugegraph.apache.org
Apache License 2.0
2.64k stars 517 forks source link

backend用mysql时连接不上mysql #172

Closed htpbackup closed 2 years ago

htpbackup commented 5 years ago

Expected behavior 期望表现

执行 $bin/init-store.sh 正常

Actual behavior 实际表现

hugegraph@CentOS7.3[/home/hugegraph/hugegraph-0.7.4]$bin/init-store.sh
Initing HugeGraph Store...
2018-11-07 00:15:40 926   [main] [INFO ] com.baidu.hugegraph.cmd.InitStore [] - Init graph with config file: conf/hugegraph.properties
2018-11-07 00:15:40 1071  [main] [INFO ] com.baidu.hugegraph.HugeGraph [] - Opening backend store 'mysql' for graph 'hugegraph'
Wed Nov 07 00:15:40 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
2018-11-07 00:15:41 1529  [main] [ERROR] com.baidu.hugegraph.HugeGraph [] - Failed to open schema transaction
com.baidu.hugegraph.backend.BackendException: Failed connect with mysql, please ensure it's ok
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:118) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.tx.AbstractTransaction.<init>(AbstractTransaction.java:72) ~[hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.backend.tx.IndexableTransaction.<init>(IndexableTransaction.java:30) ~[hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.backend.tx.SchemaTransaction.<init>(SchemaTransaction.java:63) ~[hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.backend.cache.CachedSchemaTransaction.<init>(CachedSchemaTransaction.java:49) ~[hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.HugeGraph.openSchemaTransaction(HugeGraph.java:213) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.HugeGraph.access$300(HugeGraph.java:79) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.HugeGraph$TinkerpopTransaction.schemaTransaction(HugeGraph.java:665) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.HugeGraph$TinkerpopTransaction.access$000(HugeGraph.java:528) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.HugeGraph.schemaTransaction(HugeGraph.java:258) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.backend.store.BackendStoreInfo.info(BackendStoreInfo.java:57) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.backend.store.BackendStoreInfo.exist(BackendStoreInfo.java:68) [hugegraph-core-0.7.4.jar:0.7.4.0]
        at com.baidu.hugegraph.cmd.InitStore.initGraph(InitStore.java:98) [hugegraph-dist-0.7.4.jar:?]
        at com.baidu.hugegraph.cmd.InitStore.main(InitStore.java:86) [hugegraph-dist-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.connect(MysqlSessions.java:118) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:104) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:73) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:115) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.connect(MysqlSessions.java:118) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:104) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:73) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:115) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.connect(MysqlSessions.java:118) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:104) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:73) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:115) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.connect(MysqlSessions.java:118) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:104) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:73) ~[hugegraph-mysql-0.7.4.jar:?]
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:115) ~[hugegraph-mysql-0.7.4.jar:?]
Wed Nov 07 00:15:41 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Exception in thread "main" com.baidu.hugegraph.HugeException: Failed to update/query TaskStore
        at com.baidu.hugegraph.task.HugeTaskScheduler.submit(HugeTaskScheduler.java:275)
        at com.baidu.hugegraph.task.HugeTaskScheduler.submit(HugeTaskScheduler.java:268)
        at com.baidu.hugegraph.task.HugeTaskScheduler.close(HugeTaskScheduler.java:172)
        at com.baidu.hugegraph.task.HugeTaskManager.closeScheduler(HugeTaskManager.java:67)
        at com.baidu.hugegraph.HugeGraph.close(HugeGraph.java:416)
        at com.baidu.hugegraph.cmd.InitStore.initGraph(InitStore.java:106)
        at com.baidu.hugegraph.cmd.InitStore.main(InitStore.java:86)
Caused by: java.util.concurrent.ExecutionException: com.baidu.hugegraph.backend.BackendException: Failed connect with mysql, please ensure it's ok
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at com.baidu.hugegraph.task.HugeTaskScheduler.submit(HugeTaskScheduler.java:273)
        ... 6 more
Caused by: com.baidu.hugegraph.backend.BackendException: Failed connect with mysql, please ensure it's ok
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:118)
        at com.baidu.hugegraph.backend.tx.AbstractTransaction.<init>(AbstractTransaction.java:72)
        at com.baidu.hugegraph.backend.tx.IndexableTransaction.<init>(IndexableTransaction.java:30)
        at com.baidu.hugegraph.backend.tx.GraphTransaction.<init>(GraphTransaction.java:110)
        at com.baidu.hugegraph.task.HugeTaskScheduler$TaskTransaction.<init>(HugeTaskScheduler.java:284)
        at com.baidu.hugegraph.task.HugeTaskScheduler.tx(HugeTaskScheduler.java:99)
        at com.baidu.hugegraph.task.HugeTaskScheduler.lambda$close$3(HugeTaskScheduler.java:173)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 23 milliseconds ago.  The last packet sent successfully to the server was 23 milliseconds ago.
        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.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
        at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:203)
        at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4901)
        at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)
        at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)
        at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2219)
        at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2014)
        at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)
        at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
        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.jdbc.Util.handleNewInstance(Util.java:425)
        at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
        at java.sql.DriverManager.getConnection(DriverManager.java:664)
        at java.sql.DriverManager.getConnection(DriverManager.java:247)
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.connect(MysqlSessions.java:118)
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:104)
        at com.baidu.hugegraph.backend.store.mysql.MysqlSessions.open(MysqlSessions.java:73)
        at com.baidu.hugegraph.backend.store.mysql.MysqlStore.open(MysqlStore.java:115)
        ... 11 more
Caused by: javax.net.ssl.SSLException: Server key
        at sun.security.ssl.Handshaker.throwSSLException(Handshaker.java:1391)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:274)
        at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)
        at sun.security.ssl.Handshaker.process_record(Handshaker.java:961)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
        at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:188)
        ... 32 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: MD5andSHA1withRSA, provider: SunJSSE, class: sun.security.ssl.RSASignature)
        at java.security.Provider$Service.newInstance(Provider.java:1617)
        at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
        at java.security.Signature.getInstance(Signature.java:242)
        at sun.security.ssl.JsseJce.getSignature(JsseJce.java:225)
        at sun.security.ssl.RSASignature.getInstance(RSASignature.java:70)
        at sun.security.ssl.HandshakeMessage$DH_ServerKeyExchange.<init>(HandshakeMessage.java:842)
        at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:272)
        ... 39 more
Caused by: java.security.NoSuchAlgorithmException: NONEwithRSA Signature not available
        at java.security.Signature.getInstance(Signature.java:229)
        at sun.security.ssl.JsseJce.getSignature(JsseJce.java:225)
        at sun.security.ssl.RSASignature.<init>(RSASignature.java:60)
        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 java.security.Provider$Service.newInstance(Provider.java:1595)
        ... 45 more

Steps to reproduce the problem 复现步骤

  1. {step 1}
  2. {step 2}
  3. {step 3}

Status of loaded data 数据状态

Vertex/Edge summary 数据量

Vertex/Edge example 数据示例

{type something here...}

Schema(VertexLabel, EdgeLabel, IndexLabel) 元数据结构

{type something here...}

Specifications of environment 环境信息

zhoney commented 5 years ago

@htpbackup 多谢反馈。麻烦确认两个问题:

  1. 问题可以多次复现吗?
  2. 提供一下MySQL的版本信息
htpbackup commented 5 years ago

@zhoney 没有执行成功过,mysql 5.7.19。 我自己直接写了个测试代码用mysql-connector-java-5.1.45.jar可以连数据库。

zhoney commented 5 years ago

@htpbackup 你的MySQL server端对SSL做了配置吗?看异常情况是SSL链接出错了。

我自己直接写了个测试代码用mysql-connector-java-5.1.45.jar可以连数据库。

你自己写的程序使用的user和在conf/hugegraph.properties中配置的是同一个吗?贴一下你的程序和hugegraph.properties配置文件吧(域名信息或者ip信息敏感的话,可以用假的代替)。

htpbackup commented 5 years ago

@zhoney MySQL server端没有SSL。我把mysql的表建好,直接执行"bin/start-hugegraph.sh"可以正常使用。 测试代码:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class Main {

    public static void main(String[] args){
        try {
            Class.forName("com.mysql.jdbc.Driver");
            Connection conn= DriverManager.getConnection("jdbc:mysql://10.45.4.64:3306", "kbs", "Zsmart@9");
            Statement stmt = conn.createStatement();
            stmt.execute("select sysdate()");
            ResultSet rs = stmt.getResultSet();
            if(rs.next())
                System.out.println(rs.getTimestamp(1));
            rs.close();
            stmt.close();
            conn.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}

hugegraph.properties配置文件:

gremlin.graph=com.baidu.hugegraph.HugeFactory

backend=mysql
serializer=mysql

#backend=rocksdb
#serializer=binary

store=hugegraph
rate_limit=0

search.text_analyzer=ikanalyzer
search.text_analyzer_mode=smart

# cassandra backend config
cassandra.host=localhost
cassandra.port=9042
cassandra.username=
cassandra.password=

# rocksdb backend config
rocksdb.data_path=D:\\Temp
rocksdb.wal_path=D:\\Temp

# mysql backend config
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://10.45.4.64:3306
jdbc.username=kbs
jdbc.password=Zsmart@9
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3

# palo backend config
palo.host=127.0.0.1
denghaiai commented 5 years ago

mysql java 环境问题,将jdk目录下jre\lib\ext中的jar包导入到项目中,问题能解决。但是,原因不知道,有知道的给说一下,或者其他的解决方案。

github-actions[bot] commented 2 years ago

Due to the lack of activity, the current issue is marked as stale and will be closed after 20 days, any update will remove the stale label

javeme commented 1 year ago

maybe related to: https://github.com/apache/incubator-hugegraph/pull/1672