将数据从 MySQL 导入 HDFS:ClassNotFoundException
Importing data from MySQL to HDFS: ClassNotFoundException
我正在尝试使用 Hadoop 中的 Sqoop 从 MySQL 的 "Employee" 数据库导入 "employee" table。我使用的是 Hadoop 版本“2.7.1”,Sqoop 版本“1.4.6”,JDK 版本“1.8.0_111”,MySQL 版本是“5.7.17”。我已经启动了所有的 Hadoop 服务。但是当我尝试从 mysql 数据库导入 table 时,出现异常。
我已经尝试使用 SQOOP Not able to import table 中提到的方法来解决我的问题,但是 none 对我有用。
sqoop的安装路径为:/usr/local/sqoop/
我用来导入数据的命令是:
bin/sqoop import --connect jdbc:mysql://localhost:3306/Employee --table employee --username root --password root --m 1 --target-dir /user/sqoop/sqlimport/employee
我得到的异常是:
Warning: /usr/local/sqoop/bin/../../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/sqoop/bin/../../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/sqoop/bin/../../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/sqoop/bin/../../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
17/02/06 16:44:15 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
17/02/06 16:44:15 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
17/02/06 16:44:15 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
17/02/06 16:44:15 INFO tool.CodeGenTool: Beginning code generation
Mon Feb 06 16:44:15 GMT 2017 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.
17/02/06 16:44:16 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `employee` AS t LIMIT 1
17/02/06 16:44:16 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `employee` AS t LIMIT 1
17/02/06 16:44:16 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop/hadoop-2.7.1
Note: /tmp/sqoop-hduser/compile/f278f3a3c2014397621b675f68a94873/employee.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
17/02/06 16:44:17 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hduser/compile/f278f3a3c2014397621b675f68a94873/employee.jar
17/02/06 16:44:17 WARN manager.MySQLManager: It looks like you are importing from mysql.
17/02/06 16:44:17 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
17/02/06 16:44:17 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
17/02/06 16:44:17 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
17/02/06 16:44:17 INFO mapreduce.ImportJobBase: Beginning import of employee
17/02/06 16:44:17 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
17/02/06 16:44:17 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/02/06 16:44:17 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
17/02/06 16:44:18 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
17/02/06 16:44:18 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
17/02/06 16:44:18 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
Mon Feb 06 16:44:18 GMT 2017 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.
17/02/06 16:44:18 INFO db.DBInputFormat: Using read commited transaction isolation
17/02/06 16:44:18 INFO mapreduce.JobSubmitter: number of splits:1
17/02/06 16:44:18 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local819205273_0001
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458978/parquet-avro-1.4.1.jar <- /usr/local/sqoop/bin/parquet-avro-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-avro-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458978/parquet-avro-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458979/parquet-generator-1.4.1.jar <- /usr/local/sqoop/bin/parquet-generator-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-generator-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458979/parquet-generator-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458980/commons-logging-1.1.1.jar <- /usr/local/sqoop/bin/commons-logging-1.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-logging-1.1.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458980/commons-logging-1.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458981/jackson-annotations-2.3.0.jar <- /usr/local/sqoop/bin/jackson-annotations-2.3.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-annotations-2.3.0.jar as file:/app/hadoop/tmp/mapred/local/1486399458981/jackson-annotations-2.3.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458982/jackson-core-asl-1.9.13.jar <- /usr/local/sqoop/bin/jackson-core-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-core-asl-1.9.13.jar as file:/app/hadoop/tmp/mapred/local/1486399458982/jackson-core-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458983/parquet-jackson-1.4.1.jar <- /usr/local/sqoop/bin/parquet-jackson-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-jackson-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458983/parquet-jackson-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458984/jackson-databind-2.3.1.jar <- /usr/local/sqoop/bin/jackson-databind-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-databind-2.3.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458984/jackson-databind-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458985/parquet-column-1.4.1.jar <- /usr/local/sqoop/bin/parquet-column-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-column-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458985/parquet-column-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458986/hsqldb-1.8.0.10.jar <- /usr/local/sqoop/bin/hsqldb-1.8.0.10.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/hsqldb-1.8.0.10.jar as file:/app/hadoop/tmp/mapred/local/1486399458986/hsqldb-1.8.0.10.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458987/kite-data-core-1.0.0.jar <- /usr/local/sqoop/bin/kite-data-core-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-data-core-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399458987/kite-data-core-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458988/parquet-format-2.0.0.jar <- /usr/local/sqoop/bin/parquet-format-2.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-format-2.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399458988/parquet-format-2.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458989/ant-eclipse-1.0-jvm1.2.jar <- /usr/local/sqoop/bin/ant-eclipse-1.0-jvm1.2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/ant-eclipse-1.0-jvm1.2.jar as file:/app/hadoop/tmp/mapred/local/1486399458989/ant-eclipse-1.0-jvm1.2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458990/parquet-hadoop-1.4.1.jar <- /usr/local/sqoop/bin/parquet-hadoop-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-hadoop-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458990/parquet-hadoop-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458991/commons-jexl-2.1.1.jar <- /usr/local/sqoop/bin/commons-jexl-2.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-jexl-2.1.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458991/commons-jexl-2.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458992/sqoop-1.4.6.jar <- /usr/local/sqoop/bin/sqoop-1.4.6.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/sqoop-1.4.6.jar as file:/app/hadoop/tmp/mapred/local/1486399458992/sqoop-1.4.6.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458993/opencsv-2.3.jar <- /usr/local/sqoop/bin/opencsv-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/opencsv-2.3.jar as file:/app/hadoop/tmp/mapred/local/1486399458993/opencsv-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458994/parquet-encoding-1.4.1.jar <- /usr/local/sqoop/bin/parquet-encoding-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-encoding-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458994/parquet-encoding-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458995/snappy-java-1.0.5.jar <- /usr/local/sqoop/bin/snappy-java-1.0.5.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/snappy-java-1.0.5.jar as file:/app/hadoop/tmp/mapred/local/1486399458995/snappy-java-1.0.5.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458996/mysql-connector-java-5.1.40-bin.jar <- /usr/local/sqoop/bin/mysql-connector-java-5.1.40-bin.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/mysql-connector-java-5.1.40-bin.jar as file:/app/hadoop/tmp/mapred/local/1486399458996/mysql-connector-java-5.1.40-bin.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458997/avro-mapred-1.7.5-hadoop2.jar <- /usr/local/sqoop/bin/avro-mapred-1.7.5-hadoop2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/avro-mapred-1.7.5-hadoop2.jar as file:/app/hadoop/tmp/mapred/local/1486399458997/avro-mapred-1.7.5-hadoop2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458998/jackson-core-2.3.1.jar <- /usr/local/sqoop/bin/jackson-core-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-core-2.3.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458998/jackson-core-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458999/parquet-common-1.4.1.jar <- /usr/local/sqoop/bin/parquet-common-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-common-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458999/parquet-common-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459000/kite-data-hive-1.0.0.jar <- /usr/local/sqoop/bin/kite-data-hive-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-data-hive-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459000/kite-data-hive-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459001/slf4j-api-1.6.1.jar <- /usr/local/sqoop/bin/slf4j-api-1.6.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/slf4j-api-1.6.1.jar as file:/app/hadoop/tmp/mapred/local/1486399459001/slf4j-api-1.6.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459002/commons-io-1.4.jar <- /usr/local/sqoop/bin/commons-io-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-io-1.4.jar as file:/app/hadoop/tmp/mapred/local/1486399459002/commons-io-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459003/ant-contrib-1.0b3.jar <- /usr/local/sqoop/bin/ant-contrib-1.0b3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/ant-contrib-1.0b3.jar as file:/app/hadoop/tmp/mapred/local/1486399459003/ant-contrib-1.0b3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459004/kite-hadoop-compatibility-1.0.0.jar <- /usr/local/sqoop/bin/kite-hadoop-compatibility-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-hadoop-compatibility-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459004/kite-hadoop-compatibility-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459005/jackson-mapper-asl-1.9.13.jar <- /usr/local/sqoop/bin/jackson-mapper-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-mapper-asl-1.9.13.jar as file:/app/hadoop/tmp/mapred/local/1486399459005/jackson-mapper-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459006/kite-data-mapreduce-1.0.0.jar <- /usr/local/sqoop/bin/kite-data-mapreduce-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-data-mapreduce-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459006/kite-data-mapreduce-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459007/commons-compress-1.4.1.jar <- /usr/local/sqoop/bin/commons-compress-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-compress-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399459007/commons-compress-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459008/paranamer-2.3.jar <- /usr/local/sqoop/bin/paranamer-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/paranamer-2.3.jar as file:/app/hadoop/tmp/mapred/local/1486399459008/paranamer-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459009/xz-1.0.jar <- /usr/local/sqoop/bin/xz-1.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/xz-1.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459009/xz-1.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459010/commons-codec-1.4.jar <- /usr/local/sqoop/bin/commons-codec-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-codec-1.4.jar as file:/app/hadoop/tmp/mapred/local/1486399459010/commons-codec-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459011/avro-1.7.5.jar <- /usr/local/sqoop/bin/avro-1.7.5.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/avro-1.7.5.jar as file:/app/hadoop/tmp/mapred/local/1486399459011/avro-1.7.5.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458978/parquet-avro-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458979/parquet-generator-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458980/commons-logging-1.1.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458981/jackson-annotations-2.3.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458982/jackson-core-asl-1.9.13.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458983/parquet-jackson-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458984/jackson-databind-2.3.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458985/parquet-column-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458986/hsqldb-1.8.0.10.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458987/kite-data-core-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458988/parquet-format-2.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458989/ant-eclipse-1.0-jvm1.2.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458990/parquet-hadoop-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458991/commons-jexl-2.1.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458992/sqoop-1.4.6.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458993/opencsv-2.3.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458994/parquet-encoding-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458995/snappy-java-1.0.5.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458996/mysql-connector-java-5.1.40-bin.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458997/avro-mapred-1.7.5-hadoop2.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458998/jackson-core-2.3.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458999/parquet-common-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459000/kite-data-hive-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459001/slf4j-api-1.6.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459002/commons-io-1.4.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459003/ant-contrib-1.0b3.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459004/kite-hadoop-compatibility-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459005/jackson-mapper-asl-1.9.13.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459006/kite-data-mapreduce-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459007/commons-compress-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459008/paranamer-2.3.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459009/xz-1.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459010/commons-codec-1.4.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459011/avro-1.7.5.jar
17/02/06 16:44:20 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
17/02/06 16:44:20 INFO mapreduce.Job: Running job: job_local819205273_0001
17/02/06 16:44:20 INFO mapred.LocalJobRunner: OutputCommitter set in config null
17/02/06 16:44:20 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
17/02/06 16:44:20 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
17/02/06 16:44:20 INFO mapred.LocalJobRunner: Waiting for map tasks
17/02/06 16:44:20 INFO mapred.LocalJobRunner: Starting task: attempt_local819205273_0001_m_000000_0
17/02/06 16:44:20 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
17/02/06 16:44:20 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
Mon Feb 06 16:44:20 GMT 2017 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.
17/02/06 16:44:20 INFO db.DBInputFormat: Using read commited transaction isolation
17/02/06 16:44:20 INFO mapred.MapTask: Processing split: 1=1 AND 1=1
17/02/06 16:44:20 INFO mapred.LocalJobRunner: map task executor complete.
17/02/06 16:44:20 WARN mapred.LocalJobRunner: job_local819205273_0001
java.lang.Exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class employee not found
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class employee not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:403)
at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:237)
at org.apache.sqoop.mapreduce.db.DBInputFormat.createRecordReader(DBInputFormat.java:263)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:515)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:758)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Class employee not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 12 more
17/02/06 16:44:21 INFO mapreduce.Job: Job job_local819205273_0001 running in uber mode : false
17/02/06 16:44:21 INFO mapreduce.Job: map 0% reduce 0%
17/02/06 16:44:21 INFO mapreduce.Job: Job job_local819205273_0001 failed with state FAILED due to: NA
17/02/06 16:44:21 INFO mapreduce.Job: Counters: 0
17/02/06 16:44:21 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
17/02/06 16:44:21 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 2.7879 seconds (0 bytes/sec)
17/02/06 16:44:21 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
17/02/06 16:44:21 INFO mapreduce.ImportJobBase: Retrieved 0 records.
17/02/06 16:44:21 ERROR tool.ImportTool: Error during import: Import job failed!
注:
我已经从组 "hdgroup" 中的单独用户 "hduser" 安装了 Hadoop 及其相关工具。
在这个问题上花了很多时间后,我自己找到了解决方案。我需要使用 --bindir
选项指向 sqoop 的安装目录,以通知 sqoop 服务应该从哪里获取 jar 文件。
我将数据从 MySQL 导入 HDFS 的命令是:
bin/sqoop import --connect jdbc:mysql://localhost:3306/Employee --username root --password root --m 1 --table employee --bindir /usr/local/sqoop/ --target-dir /user/sqoop/sqlimport/employee
我将数据从 HDFS 导出到 MySQL 的命令是:
bin/sqoop export --connect jdbc:mysql://localhost:3306/Employee --username root --password root --m 1 --table employeeexported --bindir /usr/local/sqoop/ --export-dir /user/sqoop/sqlimport/employee/part-m-00000
我正在尝试使用 Hadoop 中的 Sqoop 从 MySQL 的 "Employee" 数据库导入 "employee" table。我使用的是 Hadoop 版本“2.7.1”,Sqoop 版本“1.4.6”,JDK 版本“1.8.0_111”,MySQL 版本是“5.7.17”。我已经启动了所有的 Hadoop 服务。但是当我尝试从 mysql 数据库导入 table 时,出现异常。
我已经尝试使用 SQOOP Not able to import table 中提到的方法来解决我的问题,但是 none 对我有用。
sqoop的安装路径为:/usr/local/sqoop/
我用来导入数据的命令是:
bin/sqoop import --connect jdbc:mysql://localhost:3306/Employee --table employee --username root --password root --m 1 --target-dir /user/sqoop/sqlimport/employee
我得到的异常是:
Warning: /usr/local/sqoop/bin/../../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /usr/local/sqoop/bin/../../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /usr/local/sqoop/bin/../../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /usr/local/sqoop/bin/../../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
17/02/06 16:44:15 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6
17/02/06 16:44:15 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
17/02/06 16:44:15 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
17/02/06 16:44:15 INFO tool.CodeGenTool: Beginning code generation
Mon Feb 06 16:44:15 GMT 2017 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.
17/02/06 16:44:16 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `employee` AS t LIMIT 1
17/02/06 16:44:16 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `employee` AS t LIMIT 1
17/02/06 16:44:16 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/local/hadoop/hadoop-2.7.1
Note: /tmp/sqoop-hduser/compile/f278f3a3c2014397621b675f68a94873/employee.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
17/02/06 16:44:17 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hduser/compile/f278f3a3c2014397621b675f68a94873/employee.jar
17/02/06 16:44:17 WARN manager.MySQLManager: It looks like you are importing from mysql.
17/02/06 16:44:17 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
17/02/06 16:44:17 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
17/02/06 16:44:17 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
17/02/06 16:44:17 INFO mapreduce.ImportJobBase: Beginning import of employee
17/02/06 16:44:17 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
17/02/06 16:44:17 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
17/02/06 16:44:17 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
17/02/06 16:44:18 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
17/02/06 16:44:18 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
17/02/06 16:44:18 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=
Mon Feb 06 16:44:18 GMT 2017 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.
17/02/06 16:44:18 INFO db.DBInputFormat: Using read commited transaction isolation
17/02/06 16:44:18 INFO mapreduce.JobSubmitter: number of splits:1
17/02/06 16:44:18 INFO mapreduce.JobSubmitter: Submitting tokens for job: job_local819205273_0001
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458978/parquet-avro-1.4.1.jar <- /usr/local/sqoop/bin/parquet-avro-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-avro-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458978/parquet-avro-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458979/parquet-generator-1.4.1.jar <- /usr/local/sqoop/bin/parquet-generator-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-generator-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458979/parquet-generator-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458980/commons-logging-1.1.1.jar <- /usr/local/sqoop/bin/commons-logging-1.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-logging-1.1.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458980/commons-logging-1.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458981/jackson-annotations-2.3.0.jar <- /usr/local/sqoop/bin/jackson-annotations-2.3.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-annotations-2.3.0.jar as file:/app/hadoop/tmp/mapred/local/1486399458981/jackson-annotations-2.3.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458982/jackson-core-asl-1.9.13.jar <- /usr/local/sqoop/bin/jackson-core-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-core-asl-1.9.13.jar as file:/app/hadoop/tmp/mapred/local/1486399458982/jackson-core-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458983/parquet-jackson-1.4.1.jar <- /usr/local/sqoop/bin/parquet-jackson-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-jackson-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458983/parquet-jackson-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458984/jackson-databind-2.3.1.jar <- /usr/local/sqoop/bin/jackson-databind-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-databind-2.3.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458984/jackson-databind-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458985/parquet-column-1.4.1.jar <- /usr/local/sqoop/bin/parquet-column-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-column-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458985/parquet-column-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458986/hsqldb-1.8.0.10.jar <- /usr/local/sqoop/bin/hsqldb-1.8.0.10.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/hsqldb-1.8.0.10.jar as file:/app/hadoop/tmp/mapred/local/1486399458986/hsqldb-1.8.0.10.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458987/kite-data-core-1.0.0.jar <- /usr/local/sqoop/bin/kite-data-core-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-data-core-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399458987/kite-data-core-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458988/parquet-format-2.0.0.jar <- /usr/local/sqoop/bin/parquet-format-2.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-format-2.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399458988/parquet-format-2.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458989/ant-eclipse-1.0-jvm1.2.jar <- /usr/local/sqoop/bin/ant-eclipse-1.0-jvm1.2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/ant-eclipse-1.0-jvm1.2.jar as file:/app/hadoop/tmp/mapred/local/1486399458989/ant-eclipse-1.0-jvm1.2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458990/parquet-hadoop-1.4.1.jar <- /usr/local/sqoop/bin/parquet-hadoop-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-hadoop-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458990/parquet-hadoop-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458991/commons-jexl-2.1.1.jar <- /usr/local/sqoop/bin/commons-jexl-2.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-jexl-2.1.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458991/commons-jexl-2.1.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458992/sqoop-1.4.6.jar <- /usr/local/sqoop/bin/sqoop-1.4.6.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/sqoop-1.4.6.jar as file:/app/hadoop/tmp/mapred/local/1486399458992/sqoop-1.4.6.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458993/opencsv-2.3.jar <- /usr/local/sqoop/bin/opencsv-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/opencsv-2.3.jar as file:/app/hadoop/tmp/mapred/local/1486399458993/opencsv-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458994/parquet-encoding-1.4.1.jar <- /usr/local/sqoop/bin/parquet-encoding-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-encoding-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458994/parquet-encoding-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458995/snappy-java-1.0.5.jar <- /usr/local/sqoop/bin/snappy-java-1.0.5.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/snappy-java-1.0.5.jar as file:/app/hadoop/tmp/mapred/local/1486399458995/snappy-java-1.0.5.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458996/mysql-connector-java-5.1.40-bin.jar <- /usr/local/sqoop/bin/mysql-connector-java-5.1.40-bin.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/mysql-connector-java-5.1.40-bin.jar as file:/app/hadoop/tmp/mapred/local/1486399458996/mysql-connector-java-5.1.40-bin.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458997/avro-mapred-1.7.5-hadoop2.jar <- /usr/local/sqoop/bin/avro-mapred-1.7.5-hadoop2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/avro-mapred-1.7.5-hadoop2.jar as file:/app/hadoop/tmp/mapred/local/1486399458997/avro-mapred-1.7.5-hadoop2.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458998/jackson-core-2.3.1.jar <- /usr/local/sqoop/bin/jackson-core-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-core-2.3.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458998/jackson-core-2.3.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399458999/parquet-common-1.4.1.jar <- /usr/local/sqoop/bin/parquet-common-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/parquet-common-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399458999/parquet-common-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459000/kite-data-hive-1.0.0.jar <- /usr/local/sqoop/bin/kite-data-hive-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-data-hive-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459000/kite-data-hive-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459001/slf4j-api-1.6.1.jar <- /usr/local/sqoop/bin/slf4j-api-1.6.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/slf4j-api-1.6.1.jar as file:/app/hadoop/tmp/mapred/local/1486399459001/slf4j-api-1.6.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459002/commons-io-1.4.jar <- /usr/local/sqoop/bin/commons-io-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-io-1.4.jar as file:/app/hadoop/tmp/mapred/local/1486399459002/commons-io-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459003/ant-contrib-1.0b3.jar <- /usr/local/sqoop/bin/ant-contrib-1.0b3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/ant-contrib-1.0b3.jar as file:/app/hadoop/tmp/mapred/local/1486399459003/ant-contrib-1.0b3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459004/kite-hadoop-compatibility-1.0.0.jar <- /usr/local/sqoop/bin/kite-hadoop-compatibility-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-hadoop-compatibility-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459004/kite-hadoop-compatibility-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459005/jackson-mapper-asl-1.9.13.jar <- /usr/local/sqoop/bin/jackson-mapper-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/jackson-mapper-asl-1.9.13.jar as file:/app/hadoop/tmp/mapred/local/1486399459005/jackson-mapper-asl-1.9.13.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459006/kite-data-mapreduce-1.0.0.jar <- /usr/local/sqoop/bin/kite-data-mapreduce-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/kite-data-mapreduce-1.0.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459006/kite-data-mapreduce-1.0.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459007/commons-compress-1.4.1.jar <- /usr/local/sqoop/bin/commons-compress-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-compress-1.4.1.jar as file:/app/hadoop/tmp/mapred/local/1486399459007/commons-compress-1.4.1.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459008/paranamer-2.3.jar <- /usr/local/sqoop/bin/paranamer-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/paranamer-2.3.jar as file:/app/hadoop/tmp/mapred/local/1486399459008/paranamer-2.3.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459009/xz-1.0.jar <- /usr/local/sqoop/bin/xz-1.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/xz-1.0.jar as file:/app/hadoop/tmp/mapred/local/1486399459009/xz-1.0.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459010/commons-codec-1.4.jar <- /usr/local/sqoop/bin/commons-codec-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/commons-codec-1.4.jar as file:/app/hadoop/tmp/mapred/local/1486399459010/commons-codec-1.4.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Creating symlink: /app/hadoop/tmp/mapred/local/1486399459011/avro-1.7.5.jar <- /usr/local/sqoop/bin/avro-1.7.5.jar
17/02/06 16:44:19 INFO mapred.LocalDistributedCacheManager: Localized file:/usr/local/sqoop/lib/avro-1.7.5.jar as file:/app/hadoop/tmp/mapred/local/1486399459011/avro-1.7.5.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458978/parquet-avro-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458979/parquet-generator-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458980/commons-logging-1.1.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458981/jackson-annotations-2.3.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458982/jackson-core-asl-1.9.13.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458983/parquet-jackson-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458984/jackson-databind-2.3.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458985/parquet-column-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458986/hsqldb-1.8.0.10.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458987/kite-data-core-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458988/parquet-format-2.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458989/ant-eclipse-1.0-jvm1.2.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458990/parquet-hadoop-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458991/commons-jexl-2.1.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458992/sqoop-1.4.6.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458993/opencsv-2.3.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458994/parquet-encoding-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458995/snappy-java-1.0.5.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458996/mysql-connector-java-5.1.40-bin.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458997/avro-mapred-1.7.5-hadoop2.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458998/jackson-core-2.3.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399458999/parquet-common-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459000/kite-data-hive-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459001/slf4j-api-1.6.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459002/commons-io-1.4.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459003/ant-contrib-1.0b3.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459004/kite-hadoop-compatibility-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459005/jackson-mapper-asl-1.9.13.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459006/kite-data-mapreduce-1.0.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459007/commons-compress-1.4.1.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459008/paranamer-2.3.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459009/xz-1.0.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459010/commons-codec-1.4.jar
17/02/06 16:44:20 INFO mapred.LocalDistributedCacheManager: file:/app/hadoop/tmp/mapred/local/1486399459011/avro-1.7.5.jar
17/02/06 16:44:20 INFO mapreduce.Job: The url to track the job: http://localhost:8080/
17/02/06 16:44:20 INFO mapreduce.Job: Running job: job_local819205273_0001
17/02/06 16:44:20 INFO mapred.LocalJobRunner: OutputCommitter set in config null
17/02/06 16:44:20 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
17/02/06 16:44:20 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
17/02/06 16:44:20 INFO mapred.LocalJobRunner: Waiting for map tasks
17/02/06 16:44:20 INFO mapred.LocalJobRunner: Starting task: attempt_local819205273_0001_m_000000_0
17/02/06 16:44:20 INFO output.FileOutputCommitter: File Output Committer Algorithm version is 1
17/02/06 16:44:20 INFO mapred.Task: Using ResourceCalculatorProcessTree : [ ]
Mon Feb 06 16:44:20 GMT 2017 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.
17/02/06 16:44:20 INFO db.DBInputFormat: Using read commited transaction isolation
17/02/06 16:44:20 INFO mapred.MapTask: Processing split: 1=1 AND 1=1
17/02/06 16:44:20 INFO mapred.LocalJobRunner: map task executor complete.
17/02/06 16:44:20 WARN mapred.LocalJobRunner: job_local819205273_0001
java.lang.Exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class employee not found
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Class employee not found
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2195)
at org.apache.sqoop.mapreduce.db.DBConfiguration.getInputClass(DBConfiguration.java:403)
at org.apache.sqoop.mapreduce.db.DataDrivenDBInputFormat.createDBRecordReader(DataDrivenDBInputFormat.java:237)
at org.apache.sqoop.mapreduce.db.DBInputFormat.createRecordReader(DBInputFormat.java:263)
at org.apache.hadoop.mapred.MapTask$NewTrackingRecordReader.<init>(MapTask.java:515)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:758)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
at org.apache.hadoop.mapred.LocalJobRunner$Job$MapTaskRunnable.run(LocalJobRunner.java:243)
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:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Class employee not found
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:2101)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:2193)
... 12 more
17/02/06 16:44:21 INFO mapreduce.Job: Job job_local819205273_0001 running in uber mode : false
17/02/06 16:44:21 INFO mapreduce.Job: map 0% reduce 0%
17/02/06 16:44:21 INFO mapreduce.Job: Job job_local819205273_0001 failed with state FAILED due to: NA
17/02/06 16:44:21 INFO mapreduce.Job: Counters: 0
17/02/06 16:44:21 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
17/02/06 16:44:21 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 2.7879 seconds (0 bytes/sec)
17/02/06 16:44:21 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
17/02/06 16:44:21 INFO mapreduce.ImportJobBase: Retrieved 0 records.
17/02/06 16:44:21 ERROR tool.ImportTool: Error during import: Import job failed!
注:
我已经从组 "hdgroup" 中的单独用户 "hduser" 安装了 Hadoop 及其相关工具。
在这个问题上花了很多时间后,我自己找到了解决方案。我需要使用 --bindir
选项指向 sqoop 的安装目录,以通知 sqoop 服务应该从哪里获取 jar 文件。
我将数据从 MySQL 导入 HDFS 的命令是:
bin/sqoop import --connect jdbc:mysql://localhost:3306/Employee --username root --password root --m 1 --table employee --bindir /usr/local/sqoop/ --target-dir /user/sqoop/sqlimport/employee
我将数据从 HDFS 导出到 MySQL 的命令是:
bin/sqoop export --connect jdbc:mysql://localhost:3306/Employee --username root --password root --m 1 --table employeeexported --bindir /usr/local/sqoop/ --export-dir /user/sqoop/sqlimport/employee/part-m-00000