我试着把sqoop作业当作oozie操作来运行。我将mysql作为jobtracker节点上的元存储。我在某个地方读到ooziesqoop不能从import创建配置单元表。所以我想把数据转储到hdfs中。这仍然是真的吗?
我查了共享库。
我正在尝试从mssql数据库执行sqoop。
当我运行sqoop命令时,它不需要来自shell的元存储,它可以工作。
sqoop import --connect 'jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1' --table t1--target-dir /user/root/sqoop-import/tmp/t1
当我尝试将此作为sqoop操作运行时,会出现以下错误
>>> Invoking Sqoop command line now >>>
2151 [main] WARN org.apache.sqoop.tool.SqoopTool - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2259 [main] WARN org.apache.sqoop.ConnFactory - $SQOOP_CONF_DIR has not been set in the environment. Cannot check for additional configuration.
2285 [main] ERROR org.apache.sqoop.tool.BaseSqoopTool - Got error creating database manager: java.io.IOException: No manager for connect string: 'jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1'
at org.apache.sqoop.ConnFactory.getManager(ConnFactory.java:185)
at org.apache.sqoop.tool.BaseSqoopTool.init(BaseSqoopTool.java:217)
at org.apache.sqoop.tool.ImportTool.init(ImportTool.java:83)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:464)
at org.apache.sqoop.Sqoop.run(Sqoop.java:145)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:181)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:220)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:229)
at org.apache.sqoop.Sqoop.main(Sqoop.java:238)
at org.apache.oozie.action.hadoop.SqoopMain.runSqoopJob(SqoopMain.java:203)
at org.apache.oozie.action.hadoop.SqoopMain.run(SqoopMain.java:172)
at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:37)
at org.apache.oozie.action.hadoop.SqoopMain.main(SqoopMain.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:495)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:417)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332)
at org.apache.hadoop.mapred.Child$4.run(Child.java:268)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1408)
at org.apache.hadoop.mapred.Child.main(Child.java:262)
工作流.xml
<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.2" name="sqoop-wf">
<start to="sqoop-node"/>
<action name="sqoop-node">
<sqoop xmlns="uri:oozie:sqoop-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
<property>
<name>oozie.use.system.libpath</name>
<value>true</value>
</property>
<property>
<name>oozie.libpath</name>
<value>/user/oozie/share/lib/sqoop</value>
</property>
</configuration>
<command>import --connect 'jdbc:sqlserver://host;username=sqoopimport;password=password;database=db1' --table t1--target-dir /user/root/sqoop-import/tmp/t1</command>
</sqoop>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Sqoop failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>
我认为这是主要原因。我在share lib directory 2285[main]error org.apache.sqoop.tool.basesqooptool中有libs-创建数据库管理器时出错:java.io.ioexception:没有连接字符串的管理器:
我错过什么了吗?感谢您的帮助。
谢谢,阿披实
2条答案
按热度按时间t5zmwmid1#
当您使用shell(例如bash或zsh)执行sqoop时,您需要手动转义参数,以便shell不会更改它们。在您的示例中,您将jdbc url放在引号中,这样分号就不会被解释为命令的结尾。由于oozie没有使用shell调用sqoop,这些转义字符无效。因此,您应该删除在oozie工作流中为shell引入的转义。
例如:
另外请注意,建议使用参数--username和--password,而不是JDBCURL中的同名属性。
6tdlim6h2#
试着给予
--driver com.microsoft.jdbc.sqlserver.SQLServerDriver
在arguments>中,还要确保类路径中存在mssqlserverjdbcjar。