我有一个虚拟机: cloudera-quickstart-vm-5.13.0-0-virtualbox ,现在运行。
我执行下一条命令:
sudo sqoop --options-file /home/cloudera/sqoop-job/sqoop-job3.txt
测试1:
下一个文件#1(sqoop-job3.txt)的内容:
job
--create
jobCreateWarehouse_EMP
-- import --connect 'jdbc:oracle:thin:@//localhost:1521/xe' --username 'SYSTEM' --password '123123' --hive-import -e 'SELECT t.* FROM EMP t WHERE $CONDITIONS' --target-dir '/home/cloudera/EMP' --hive-table 'EMP' --split-by 't.EMPNO'
例外:
19/06/07 01:02:09 ERROR sqoop.Sqoop: Error while expanding arguments
java.lang.Exception: Malformed option in options file(/home/cloudera/sqoop-job/sqoop-job3.txt): -- import --connect 'jdbc:oracle:thin:@//localhost:1521/xe' --username 'SYSTEM' --password '123123' --hive-import -e 'SELECT t.* FROM EMP t WHERE $CONDITIONS' --target-dir '/home/cloudera/EMP' --hive-table 'EMP' --split-by 't.EMPNO'
at org.apache.sqoop.util.OptionsFileUtil.removeQuoteCharactersIfNecessary(OptionsFileUtil.java:170)
at org.apache.sqoop.util.OptionsFileUtil.removeQuotesEncolosingOption(OptionsFileUtil.java:143)
at org.apache.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:90)
at com.cloudera.sqoop.util.OptionsFileUtil.expandArguments(OptionsFileUtil.java:33)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:215)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243)
at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
Malformed option in options file(/home/cloudera/sqoop-job/sqoop-job3.txt): -- import --connect 'jdbc:oracle:thin:@//localhost:1521/xe' --username 'SYSTEM' --password '123123' --hive-import -e 'SELECT t.* FROM EMP t WHERE $CONDITIONS' --target-dir '/home/cloudera/EMP' --hive-table 'EMP' --split-by 't.EMPNO'
Try 'sqoop help' for usage.
测试2:
我在下一个更改了文件(sqoop-job3.txt)的内容:
job
--create
jobCreateWarehouse_EMP
-- import
--connect
'jdbc:oracle:thin:@//localhost:1521/xe'
--username
'SYSTEM'
--password
'123123'
--hive-import
-e
'SELECT t.* FROM EMP t WHERE $CONDITIONS'
--target-dir
'/home/cloudera/EMP'
--hive-table
'EMP'
--split-by
't.EMPNO'
它显示下一个异常:
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
19/06/07 01:10:36 INFO sqoop.Sqoop: Running Sqoop version: 1.4.6-cdh5.13.0
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Error parsing arguments for job:
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: -- import
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --connect
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: jdbc:oracle:thin:@//localhost:1521/xe
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --username
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: SYSTEM
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --password
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: 123123
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --hive-import
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: -e
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: SELECT t.* FROM EMP t WHERE $CONDITIONS
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --target-dir
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: /home/cloudera/EMP
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --hive-table
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: EMP
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: --split-by
19/06/07 01:10:36 ERROR tool.BaseSqoopTool: Unrecognized argument: t.EMPNO
Try --help for usage instructions.
如何创建选项文件以通过导入创建作业?
答案 0 :(得分:0)
必须在第一个版本的Sqoop中为导入命令创建一个Option文件。我已经在色调中创建了一个职位。