SQOOP QUERY:无法连接到远程服务器MySQL

时间:2018-07-10 18:01:53

标签: mysql hadoop jdbc sqoop

我遇到需要sqoop连接到远程ipaddress mysql的情况。     我可以通过触发以下命令从腻子连接到mysql:

mysql -u ro -p -h x.x.x.x -P 4307 orders --enable-cleartext-plugin

但是,我无法从sqoop连接到远程ip:x.x.x.x     我正在 Communications link failure error 。我认为此错误的原因可能是:SSL证书已过期,因为我们正在连接到远程服务器。     下面是生成的错误日志。即使我在sqoop中关闭了ssl选项,它也会说原因:java.sql.SQLException:使用明文身份验证时需要ssl     sqoop可以连接到远程服务器mysql吗?

任何帮助将不胜感激

谢谢

  

命令:sqoop list-tables --connect   'jdbc:mysql://x.x.x.x:4307 / orders'-用户名abc-密码abc

     

警告:/usr/lib/sqoop/../hbase不存在! HBase导入将   失败。请将$ HBASE_HOME设置为HBase安装的根目录。   警告:/usr/lib/sqoop/../hcatalog不存在! HCatalog职位将   失败。请将$ HCAT_HOME设置为HCatalog安装的根目录。   警告:/usr/lib/sqoop/../accumulo不存在! Accumulo进口   将失败。请将$ ACCUMULO_HOME设置为Accumulo的根   安装。警告:/usr/lib/sqoop/../zookeeper不存在!   Accumulo导入将失败。请将$ ZOOKEEPER_HOME设置为的根   您的Zookeeper安装。 2010年18月7日12:18:45信息sqoop.Sqoop:   正在运行的Sqoop版本:1.4.7 18/07/10 12:18:45警告   tool.BaseSqoopTool:在命令行上设置密码是   不安全。考虑改用-P。 2010年18月7日12:18:45信息   manager.MySQLManager:准备使用MySQL流式结果集。   2018年EDT星期二7月10日12:18:46警告:不建立SSL连接   不建议使用服务器的身份验证。根据MySQL   5.5.45 +,5.6.26 +和5.7.6+要求如果未设置显式选项,则默认情况下必须建立SSL连接。为了遵守   与不使用SSL的现有应用程序的verifyServerCertificate   属性设置为“ false”。您需要明确禁用SSL   通过设置useSSL = false或设置useSSL = true并为   服务器证书验证。 10/7/18 12:18:46错误   manager.CatalogQueryManager:无法列出表   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通讯链接失败

     

从服务器成功收到的最后一个数据包是476   毫秒前。成功发送到服务器的最后一个数据包是   465毫秒前。           在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)处           在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)           在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)           在java.lang.reflect.Constructor.newInstance(Constructor.java:423)           在com.mysql.jdbc.Util.handleNewInstance(Util.java:425)           在com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)           在com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:203)           在com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4901)           在com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)           在com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)           在com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)           在com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2219)           在com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2014)           在com.mysql.jdbc.ConnectionImpl。(ConnectionImpl.java:776)           在com.mysql.jdbc.JDBC4Connection。(JDBC4Connection.java:47)           在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)处           在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)           在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)           在java.lang.reflect.Constructor.newInstance(Constructor.java:423)           在com.mysql.jdbc.Util.handleNewInstance(Util.java:425)           在com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)           在com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)           在java.sql.DriverManager.getConnection(DriverManager.java:664)           在java.sql.DriverManager.getConnection(DriverManager.java:247)           在org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:904)           在org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)           在org.apache.sqoop.manager.CatalogQueryManager.listTables(CatalogQueryManager.java:102)           在org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)           在org.apache.sqoop.Sqoop.run(Sqoop.java:147)           在org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)           在org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)          在org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)           在org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)           在org.apache.sqoop.Sqoop.main(Sqoop.java:252)处由于:javax.net.ssl.SSLHandshakeException:   java.security.cert.CertificateExpiredException:NotAfter:1月19日星期五   美国东部标准时间14:35:17           在sun.security.ssl.Alerts.getSSLException(Alerts.java:192)           在sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959)           在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)           在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)           在sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514)           在sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)           在sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)           在sun.security.ssl.Handshaker.process_record(Handshaker.java:961)           在sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)           在sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)           在sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)           在sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)          在com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:188)           ... 27更多原因:java.security.cert.CertificateExpiredException:NotAfter:星期五1月19日   美国东部标准时间14:35:17           在sun.security.x509.CertificateValidity.valid(CertificateValidity.java:274)           在sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:629)           在sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:602)           在com.mysql.jdbc.ExportControlled $ X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:286)           在sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:985)           在sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496)           ... 35更多18/07/10 12:18:46错误sqoop.Sqoop:运行Sqoop时出现异常:java.lang.RuntimeException:   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通讯链接失败

     

从服务器成功收到的最后一个数据包是476   毫秒前。成功发送到服务器的最后一个数据包是   465毫秒前。 java.lang.RuntimeException:   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通讯链接失败

     

从服务器成功收到的最后一个数据包是476   毫秒前。成功发送到服务器的最后一个数据包是   465毫秒前。           在org.apache.sqoop.manager.CatalogQueryManager.listTables(CatalogQueryManager.java:118)           在org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)           在org.apache.sqoop.Sqoop.run(Sqoop.java:147)           在org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)           在org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)           在org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)           在org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)           在org.apache.sqoop.Sqoop.main(Sqoop.java:252)处由以下原因引起:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:   通讯链接失败

     

从服务器成功收到的最后一个数据包是476   毫秒前。成功发送到服务器的最后一个数据包是   465毫秒前。           在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)处           在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)           在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)           在java.lang.reflect.Constructor.newInstance(Constructor.java:423)           在com.mysql.jdbc.Util.handleNewInstance(Util.java:425)           在com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)           在com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:203)           在com.mysql.jdbc.MysqlIO.negotiateSSLConnection(MysqlIO.java:4901)           在com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1659)           在com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226)           在com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)           在com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2219)           在com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2014)           在com.mysql.jdbc.ConnectionImpl。(ConnectionImpl.java:776)           在com.mysql.jdbc.JDBC4Connection。(JDBC4Connection.java:47)           在sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)处           在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)           在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)           在java.lang.reflect.Constructor.newInstance(Constructor.java:423)           在com.mysql.jdbc.Util.handleNewInstance(Util.java:425)           在com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)           在com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)           在java.sql.DriverManager.getConnection(DriverManager.java:664)           在java.sql.DriverManager.getConnection(DriverManager.java:247)           在org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:904)           在org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:59)           在org.apache.sqoop.manager.CatalogQueryManager.listTables(CatalogQueryManager.java:102)           ... 7更多原因:javax.net.ssl.SSLHandshakeException:java.security.cert.CertificateExpiredException:NotAfter:周五1月19日   美国东部标准时间14:35:17           在sun.security.ssl.Alerts.getSSLException(Alerts.java:192)           在sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1959)           在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)           在sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)           在sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514)           在sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216)           在sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)           在sun.security.ssl.Handshaker.process_record(Handshaker.java:961)           在sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)           在sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)           在sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)           在sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)           在com.mysql.jdbc.ExportControlled.transformSocketToSSLSocket(ExportControlled.java:188)           ... 27更多原因:java.security.cert.CertificateExpiredException:NotAfter:星期五1月19日   美国东部标准时间14:35:17           在sun.security.x509.CertificateValidity.valid(CertificateValidity.java:274)           在sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:629)           在sun.security.x509.X509CertImpl.checkValidity(X509CertImpl.java:602)           在com.mysql.jdbc.ExportControlled $ X509TrustManagerWrapper.checkServerTrusted(ExportControlled.java:286)           在sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:985)           在sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1496)           ...另外35个

1 个答案:

答案 0 :(得分:0)

请尝试-

1)转到my.cnf

2)注释bind-address(仅接受本地连接)

“绑定地址= 127.0.0.1”

“#bind-address = 127.0.0.1”

3)重新启动mysql

也请检查此-

jdbc mysql communications link failure to remote database