Oozie 协调工作流

Oozie coordinated workflow

我需要 运行 基于命中相同 table 的不同文件集的多个 mapreduce 作业。我正在探索 Oozie,但我并不完全了解 Oozie。

我的要求是
1. 运行 作业基于时间限制 (and/or) 文件限制。
2.如果某些文件不可用,则应跳过此步骤。
3. 用户应该能够配置哪些步骤以及每个步骤的优先级。

任何人都可以建议 Oozie 是否符合我的要求?如果是这样,我该如何完成?
如果没有,是否有任何类似于 Visual Cron 的免费或商业工具,我们打算将其替换为 运行 map reduce 和基于 java 的作业?

基本上,您想要 运行 一个 oozie 工作流,用于根据一天中预定时间的数据可用性来处理 MR 作业。您需要定义 Decision 节点来检查数据是否存在,并定义 mapreduce 操作来 运行 mapreduce 作业。您也可以为作业失败定义邮件通知功能。您可以在此处找到详细信息 MapReduce Node, Decision Node, Oozie Actions Documentation。我已经给出了示例 decision 节点和 mapreduce 节点以及 job.properties 文件。这是 运行 oozie 工作流程的命令。您可以将其安排为每天在给定时间 运行 运行它的 cron。

oozie job -config job.properties -D param1=value -run

<workflow-app xmlns="uri:oozie:workflow:0.4" name="${app_name}">
<global>
    <job-tracker>${jobTracker}</job-tracker>
    <name-node>${nameNode}</name-node>
    <configuration>
        <property>
            <name>mapred.job.queue.name</name>
            <value>${queueName}</value>
        </property>
    </configuration>
</global>

<start to="data1_check"/>

<decision name="data1_check">
    <switch>
        <case to="data1_job">${fs:exists(input-data)}</case>
        <default to="data2_check"/>
    </switch>
</decision>

<action name='data1_job'>
    <map-reduce>
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <prepare>
        </prepare>
        <configuration>
            <property>
                <name>mapred.mapper.class</name>
                <value>org.myorg.WordCount.Map</value>
            </property>
            <property>
                <name>mapred.reducer.class</name>
                <value>org.myorg.WordCount.Reduce</value>
            </property>
            <property>
                <name>mapred.input.dir</name>
                <value>${inputDir}</value>
            </property>
            <property>
                <name>mapred.output.dir</name>
                <value>${outputDir}</value>
            </property>
        </configuration>
    </map-reduce>
    <ok to="data2_check"/>
    <error to="data2_check"/>
</action>
###Here we are going to data2_check decision node for both failure and success.
Because you want to run the next data job to run. You can stop the work flow by sending it to kill node failure.


###Your Last MR action will go to 'kill'  node for failure and 'end' node for success.
<kill name="fail">
    <message>Errormessage[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>

<end name="end" />
</workflow-app>

这是 job.properties 文件。

nameNode=hdfs://localhost:9000    # or use a remote-server url. eg: hdfs://abc.xyz.yahoo.com:8020
jobTracker=localhost:9001         # or use a remote-server url. eg: abc.xyz.yahoo.com:50300
queueName=default
examplesRoot=map-reduce

oozie.wf.application.path=${nameNode}/user/${user.name}/${examplesRoot}
inputDir=input-data
outputDir=map-reduce

引用“Oozie Coord Use Cases(来自在 Oozie 开源之前实际使用过它的人 - 目前仍然是最大的用户)

Here are some typical use cases for the Oozie Coordinator Engine.

  • You want to run your workflow once a day at 2PM (similar to a CRON).
  • You want to run your workflow every hour and you also want to wait for specific data feeds to be available on HDFS
  • You want to run a workflow that depends on other workflows.

继续教程。

顺便说一句,Oozie 的最新版本是 V4.2 => Coordinator

的文档