使用Sqoop

时间:2018-05-18 10:36:01

标签: sqoop

我正在尝试使用sqoop从Mysql数据库导入表。 Mysql安装在安装了sqoop,hadoop和hive的同一个盒子里,我可以从终端访问数据库。在尝试导入低于错误时。请帮忙解决这个问题。

sqoop/bin$ ./sqoop import --connect jdbc:mysql://localhost/sqoop_test --username **** --password ***** --table emp2 --delete-target-dir -m 1;
Warning: /home/skd799/Downloads/sqoop/../hbase does not exist! HBase imports will fail.
Please set $HBASE_HOME to the root of your HBase installation.
Warning: /home/skd799/Downloads/sqoop/../hcatalog does not exist! HCatalog jobs will fail.
Please set $HCAT_HOME to the root of your HCatalog installation.
Warning: /home/skd799/Downloads/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
Warning: /home/skd799/Downloads/sqoop/../zookeeper does not exist! Accumulo imports will fail.
Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.
18/05/18 15:24:09 INFO sqoop.Sqoop: Running Sqoop version: 1.4.5
18/05/18 15:24:09 WARN tool.BaseSqoopTool: Setting your password on the command-line is insecure. Consider using -P instead.
18/05/18 15:24:09 INFO manager.MySQLManager: Preparing to use a MySQL streaming resultset.
18/05/18 15:24:09 INFO tool.CodeGenTool: Beginning code generation
18/05/18 15:24:10 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `emp2` AS t LIMIT 1
18/05/18 15:24:10 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM `emp2` AS t LIMIT 1
18/05/18 15:24:10 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /home/skd799/Downloads/hadoop
Note: /tmp/sqoop-hduser/compile/d58481969b312338b764bc550c174b3a/emp2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
18/05/18 15:24:11 INFO orm.CompilationManager: Writing jar file: /tmp/sqoop-hduser/compile/d58481969b312338b764bc550c174b3a/emp2.jar
18/05/18 15:24:12 INFO tool.ImportTool: Destination directory emp2 deleted.
18/05/18 15:24:12 WARN manager.MySQLManager: It looks like you are importing from mysql.
18/05/18 15:24:12 WARN manager.MySQLManager: This transfer can be faster! Use the --direct
18/05/18 15:24:12 WARN manager.MySQLManager: option to exercise a MySQL-specific fast path.
18/05/18 15:24:12 INFO manager.MySQLManager: Setting zero DATETIME behavior to convertToNull (mysql)
18/05/18 15:24:12 INFO mapreduce.ImportJobBase: Beginning import of emp2
18/05/18 15:24:13 INFO db.DBInputFormat: Using read commited transaction isolation
18/05/18 15:24:14 INFO db.DBInputFormat: Using read commited transaction isolation
18/05/18 15:24:15 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
18/05/18 15:24:15 INFO mapreduce.ImportJobBase: Transferred 0 bytes in 2.9424 seconds (0 bytes/sec)
18/05/18 15:24:15 WARN mapreduce.Counters: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
18/05/18 15:24:15 INFO mapreduce.ImportJobBase: Retrieved 0 records.
18/05/18 15:24:15 ERROR tool.ImportTool: Error during import: Import job failed!

1 个答案:

答案 0 :(得分:0)

可以编写sqoop查询以导入表格