Apache Sqoop 连接错误

Posted

技术标签:

【中文标题】Apache Sqoop 连接错误【英文标题】:Apache Sqoop connectivity error 【发布时间】:2014-12-17 20:07:08 【问题描述】:

尝试使用 sqoop 从 mysql 数据库中列出数据库时出现以下错误。我正在使用 Cloudera VM CDH4,但默认情况下它没有预安装 MySql。我按照cloudera教程安装了MySql。现在我试图从 MySQl 列出数据库,但它失败了。是否存在任何 jdbc 连接问题?

[cloudera@localhost ~]$ sqoop list-databases --connect "jdbc:mysql://localhost.localdomain" --user root --password aaaaaaaa
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
14/12/17 11:52:07 INFO sqoop.Sqoop: Running Sqoop version: 1.4.3-cdh4.7.0
14/12/17 11:52:07 ERROR tool.BaseSqoopTool: Error parsing arguments for list-databases:
14/12/17 11:52:07 ERROR tool.BaseSqoopTool: Unrecognized argument: --user
14/12/17 11:52:07 ERROR tool.BaseSqoopTool: Unrecognized argument: root
14/12/17 11:52:07 ERROR tool.BaseSqoopTool: Unrecognized argument: --password
14/12/17 11:52:07 ERROR tool.BaseSqoopTool: Unrecognized argument: aaaaaaaa

Try --help for usage instructions.
usage: sqoop list-databases [GENERIC-ARGS] [TOOL-ARGS]

Common arguments:
   --connect <jdbc-uri>                         Specify JDBC connect
                                                string
   --connection-manager <class-name>            Specify connection manager
                                                class name
   --connection-param-file <properties-file>    Specify connection
                                                parameters file
   --driver <class-name>                        Manually specify JDBC
                                                driver class to use
   --hadoop-home <hdir>                         Override
                                                $HADOOP_MAPRED_HOME_ARG
   --hadoop-mapred-home <dir>                   Override
                                                $HADOOP_MAPRED_HOME_ARG
   --help                                       Print usage instructions
-P                                              Read password from console
   --password <password>                        Set authentication
                                                password
   --password-file <password-file>              Set authentication
                                                password file path
   --skip-dist-cache                            Skip copying jars to
                                                distributed cache
   --username <username>                        Set authentication
                                                username
   --verbose                                    Print more information
                                                while working

Generic Hadoop command-line arguments:
(must preceed any tool-specific arguments)
Generic options supported are
-conf <configuration file>     specify an application configuration file
-D <property=value>            use value for given property
-fs <local|namenode:port>      specify a namenode
-jt <local|jobtracker:port>    specify a job tracker
-files <comma separated list of files>    specify comma separated files to be copied to the map reduce cluster
-libjars <comma separated list of jars>    specify comma separated jar files to include in the classpath.
-archives <comma separated list of archives>    specify comma separated archives to be unarchived on the compute machines.

The general command line syntax is
bin/hadoop command [genericOptions] [commandOptions]

【问题讨论】:

【参考方案1】:

试试这个:

sqoop list-databases --connect jdbc:mysql://localhost \
  --username root \
  --password aaaaaaaa

问题是 Sqoop 没有选项 --user 而您必须使用 --username

【讨论】:

以上是关于Apache Sqoop 连接错误的主要内容,如果未能解决你的问题,请参考以下文章

Sqoop拒绝连接错误

通过 SQOOP 连接到 DB2 时出现连接管理器错误

sqoop连接MySQL失败解决案例

sqoop连接MySQL失败解决案例

sqoop连接MySQL失败解决案例

Apache sqoop 错误