ubuntu中sqoop连接MySQL失败
hadoop@node-virtual-machine:~$ sqoop list-databases --connect jdbc:mysql://localhost:3306/movies?characterEncoding=UTF-8 --username root --password '123456'
Warning: /usr/local/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
22/05/12 23:18:03 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
22/05/12 23:18:03 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
Thu May 12 23:18:04 CST 2022 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.
information_schema
hadoop_class
hiveDB
movies
mysql
performance_schema
sys
Thu May 12 23:18:05 CST 2022 WARN: Caught while disconnecting...
EXCEPTION STACK TRACE:
** BEGIN NESTED EXCEPTION **
javax.net.ssl.SSLException
MESSAGE: closing inbound before receiving peer's close_notify
STACKTRACE:
javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify
at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:726)
at sun.security.ssl.SSLSocketImpl.shutdownInput(SSLSocketImpl.java:705)
at com.mysql.jdbc.MysqlIO.quit(MysqlIO.java:2249)
at com.mysql.jdbc.ConnectionImpl.realClose(ConnectionImpl.java:4221)
at com.mysql.jdbc.ConnectionImpl.close(ConnectionImpl.java:1464)
at org.apache.sqoop.manager.GenericJdbcManager.discardConnection(GenericJdbcManager.java:78)
at org.apache.sqoop.manager.GenericJdbcManager.close(GenericJdbcManager.java:88)
at org.apache.sqoop.tool.BaseSqoopTool.destroy(BaseSqoopTool.java:305)
at org.apache.sqoop.tool.ListDatabasesTool.run(ListDatabasesTool.java:60)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
** END NESTED EXCEPTION **
原因:用户权限问题。
安装sqoop后马上用下面命令修改了权限,以至于后面把mysql-connector-java-5.1.49.jar复制到/usr/local/sqoop/lib下时,jar包的权限不是hadoop用户的,而是node用户的。
hadoop@node-virtual-machine:/usr/local$ sudo chown -R hadoop:hadoop sqoop/
node@node-virtual-machine:~$ sudo mv mysql-connector-java-5.1.49.jar /usr/local/sqoop/lib
[sudo] node 的密码:
解决:再修改一次权限
hadoop@node-virtual-machine:/usr/local$sudo chown -R hadoop:hadoop sqoop/
再次连接mysql,成功
hadoop@node-virtual-machine:~$ sqoop list-databases --connect jdbc:mysql://localhost:3306/hadoop_class?characterEncoding=UTF-8 --username root --password '123456'
Warning: /usr/local/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
22/05/12 23:37:34 INFO sqoop.Sqoop: Running Sqoop version: 1.4.7
22/05/12 23:37:34 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
22/05/12 23:37:35 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
Thu May 12 23:37:35 CST 2022 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.
information_schema
hadoop_class
hiveDB
mysql
performance_schema
sys
|