尝试读取表参数

时间:2017-05-03 21:38:22

标签: java hdfs sqoop

我正在尝试将一些数据导入到hive表中,但我的sqoop作业失败

sqoop import -libjars '/var/lib/sqoop/DB2JccConfiguration.properties' 
--connect 'jdbc:db2://localhost/test;' --username 'name' 
--password-file 'pword' --num-mappers 16 
--query "SELECT P_NUMBER,AG, EFFECTIVE_DATE, EXPIRATION_DATE, ST, ZIP FROM wU99.snapshot WHERE ZIP = 15392 AND \$CONDITIONS"
--split-by 'AG'--hive-import --hive-table ag.test 
--target_dir '/user/name/Test'


Warning: /opt/cloudera/parcels/CDH-5.8.3-1.cdh5.8.3.p2036.2124/bin/../lib/sqoop/../accumulo does not exist!     
Accumulo imports will fail.Please set $ACCUMULO_HOME to the root of your Accumulo installation.
17/05/03 16:21:10 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.8.3
17/05/03 16:21:12 ERROR tool.BaseSqoopTool: Error parsing arguments for import:
17/05/03 16:21:12 ERROR tool.BaseSqoopTool: Unrecognized argument: AG--hive-import
17/05/03 16:21:12 ERROR tool.BaseSqoopTool: Unrecognized argument: --hive-table
17/05/03 16:21:12 ERROR tool.BaseSqoopTool: Unrecognized argument: ag.test
17/05/03 16:21:12 ERROR tool.BaseSqoopTool: Unrecognized argument: --target_dir
17/05/03 16:21:12 ERROR tool.BaseSqoopTool: Unrecognized argument: /user/name/Test

我不知道为什么它在试图读表时失败了。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

  1. 'AG'--hive-import
  2. 之间应该有空格
  3. 应该是--target-dir而不是--target_dir

答案 1 :(得分:0)

sqoop import -libjars '/var/lib/sqoop/DB2JccConfiguration.properties' --connect 'jdbc:db2://localhost/test;' --username 'name' --password-file 'pword' --num-mappers 16 --query "SELECT P_NUMBER,AG, EFFECTIVE_DATE, EXPIRATION_DATE, ST, ZIP FROM wU99.snapshot WHERE ZIP = 15392 AND \$CONDITIONS" --split-by 'AG' --hive-database 'your_database_name' --hive-import
--target-dir '/user/name/Test'