美文网首页
canal出现ERROR com.alibaba.druid.p

canal出现ERROR com.alibaba.druid.p

作者: WMSmile | 来源:发表于2022-02-18 13:42 被阅读0次

    环境:
    系统:Ubuntu 20.04
    数据库:MySQL5.7.37
    canal-adapter:1.1.15

    出现问题 ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/canal_test?useUnicode=true, errorCode 0, state 08S01
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    2022-02-18 05:08:45.307 [Druid-ConnectionPool-Create-2095970915] ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/canal_test?useUnicode=true, errorCode 0, state 08S01
    com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
    
    The last packet successfully received from the server was 3 milliseconds ago.  The last packet sent successfully to the server was 3 milliseconds ago.
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_312]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_312]
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_312]
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_312]
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:201) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4869) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1656) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1217) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2189) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2220) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2015) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:768) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_312]
            at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_312]
            at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_312]
            at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_312]
            at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:385) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:323) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1657) ~[druid-1.2.6.jar:1.2.6]
            at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1723) ~[druid-1.2.6.jar:1.2.6]
            at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2801) ~[druid-1.2.6.jar:1.2.6]
    Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
            at sun.security.ssl.HandshakeContext.<init>(HandshakeContext.java:171) ~[na:1.8.0_312]
            at sun.security.ssl.ClientHandshakeContext.<init>(ClientHandshakeContext.java:103) ~[na:1.8.0_312]
            at sun.security.ssl.TransportContext.kickstart(TransportContext.java:220) ~[na:1.8.0_312]
            at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:428) ~[na:1.8.0_312]
            at com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:186) ~[mysql-connector-java-5.1.48.jar:5.1.48]
            ... 18 common frames omitted
    

    检查一下

    1、未开启远程操作权限
    登录MySQL

    CREATE USER canal IDENTIFIED BY 'canal';  
    GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';
    -- GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ;
    FLUSH PRIVILEGES;
    

    2、需要在项目的application.yml配置中加上:&useSSL=false&serverTimezone=UTC

      srcDataSources:
        defaultDS:
          url: jdbc:mysql://127.0.0.1:3306/canal_test?useUnicode=true&useSSL=false
          username: canal
          password: canal
    

    相关文章

      网友评论

          本文标题:canal出现ERROR com.alibaba.druid.p

          本文链接:https://www.haomeiwen.com/subject/hrhylrtx.html