【发布时间】:2016-06-16 16:25:55
【问题描述】:
我正在尝试通过创建 oozie 工作流,使用 sqoop 将 mysql 表导入 hdfs。
我已经在 oozie sharelib 中复制了 mysql 连接器,即在
/user/{username}/share/lib/lib_20150914123648/sqoop/
我还复制了我的 sqoop-import 文件夹,其中包含 job.properties 和 workflow.xml 文件。
我可以通过引用 https://oozie.apache.org/docs/3.1.3-incubating/DG_Examples.html 来执行示例 Mapreduce 作业
我可以提交作业,但显示作业是作业被终止并出现错误
Sqoop failed, error message[java.lang.ClassNotFoundException: Class org.apache.oozie.action.hadoop.SqoopMain not found]
这是我的 job.properties 文件
nameNode=hdfs://localhost:9000
jobTracker=localhost:8032
queueName=default
examplesRoot=sqoop-import
oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}/app/sqoop
这是我的 workflow.xml 文件
<action name="sqoop-node">
<sqoop xmlns="uri:oozie:sqoop-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}/user/${wf:user()}/${examplesRoot}/output-data/sqoop"/>
<mkdir path="${nameNode}/user/${wf:user()}/${examplesRoot}/output-data"/>
</prepare>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<command>import --connect jdbc:mysql://localhost:3306/test --username root --password root --table user --target-dir /user/${wf:user()}/${examplesRoot}/output-data/sqoop -m 1</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"/>
然后我通过发出命令来启动作业
oozie job -oozie http://localhost:11000/oozie -config oozie-import/apps/sqoop/job.properties -run
谁能帮我解决这个问题。
【问题讨论】:
-
将 sqoop jar 添加到 oozie sharelib 文件夹
-
您需要检查来自启动器作业的
stderr和stdout日志以了解 sqoop 操作。这将为您提供失败的确切原因。 -
@vishnu ->> 已经在 hdfs 的 sharelib 中添加了 sqoop jar,路径是 /user/hduser/share/liblib_20150914123648/sqoop。
-
您可能需要在 job.properties 中添加 oozie.use.system.libpath=true