【发布时间】:2016-01-12 11:35:01
【问题描述】:
我正在使用 Oozie 来安排非 map-reduce hadoop 作业。 hadoop 作业在 oozie 中运行,没有给出任何错误。我想使用该 hadoop 作业提交另一个非 map-reduce hadoop 作业。我该怎么做?
【问题讨论】:
我正在使用 Oozie 来安排非 map-reduce hadoop 作业。 hadoop 作业在 oozie 中运行,没有给出任何错误。我想使用该 hadoop 作业提交另一个非 map-reduce hadoop 作业。我该怎么做?
【问题讨论】:
在 Oozie 中,您可以在同一工作流程中调用另一个操作来调用多个 hadoop 作业,只需检查它应该调用具有不同操作名称的不同操作。
以下示例可以提供帮助
例如:oozie 将调用两个 shell 脚本,这将作为 第一个脚本 copy.sh 将执行从 cluster1 到 cluster2 的 distcp 操作 第二个脚本将执行将复制的转储从 cluster2 下载到本地位置。 所以工作流程会是这样的:
<workflow-app xmlns='uri:oozie:workflow:0.2' name='testworkflowaction'>
<start to='UserVectorUpload'/>
<action name="shellAction_1">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>oozie.launcher.mapred.job.queue.name</name>
<value>default</value>
</property>
</configuration>
<exec>scipt_copy.sh</exec>
<file>hdfs://cluster2:8020/localtion_of_script_in_cluster/scipt_copy.sh</file>
<capture-output/>
</shell>
<ok to="shellAction_2"/>
<error to="killAction"/>
</action>
<kill name="killAction">
<message>Shell Action Failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="shellAction_2">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>oozie.launcher.mapred.job.queue.name</name>
<value>default</value>
</property>
</configuration>
<exec>scipt_download.sh</exec>
<file>hdfs://cluster2:8020/localtion_of_script_in_cluster/scipt_download.sh</file>
<capture-output/>
</shell>
<ok to="end"/>
<error to="killAction"/>
</action>
<kill name="killAction">
<message>Shell Action Failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
所以通过上面的例子,第一个动作是使用 distcp 从 clustet1 执行 script_copy.sh 到 cluster2,一旦 distcp 完成,它将使用 get 或 copyToLocal 函数。
您可以使用的另一个替代选项,将单个脚本中的动作和单个动作中的所有动作组合在一起,尽管此步骤对脚本没有用处 过程非常复杂。
【讨论】: