如果在给定文件夹中发生任何更改,如何安排OOZIE作业?

时间:2016-08-02 07:07:42

标签: hadoop oozie hadoop-streaming oozie-coordinator cloudera-quickstart-vm

我想安排一个基于文件夹的oozie作业,即

我在HDFS位置有一个文件夹,每天都会在该文件夹中添加一个文件,格式为date.txt(exp:20160802.txt)。

如果在该文件夹中添加任何新文件,我想安排OOZIE批次。

请帮我解决这个问题,如何在我的用例场景中安排。

提前致谢。

1 个答案:

答案 0 :(得分:1)

Oozie工作流作业基于常规时间间隔和/或数据可用性运行。并且,在某些情况下,它们可以由外部事件触发。协调员在这里发挥作用。

您可以使用oozie协调器检查数据依赖性并使用协调器EL functions触发oozie工作流 在您的情况下,您的文件每天都会被添加到带时间戳的hdfs.So,您可以使用数据集。

来自文档

示例每天在00:15 PST8PDT生成一次的数据集,并将done-flag设置为空:

  <dataset name="logs" frequency="${coord:days(1)}"
           initial-instance="2009-02-15T08:15Z" timezone="America/Los_Angeles">
    <uri-template>
      hdfs://foo:9000/app/logs/${market}/${YEAR}${MONTH}/${DAY}/data
    </uri-template>
    <done-flag></done-flag>
  </dataset>
The dataset would resolve to the following URIs and Coordinator looks for the existence of the directory itself:

  [market] will be replaced with user given property.  hdfs://foo:9000/usr/app/[market]/2009/02/15/data
  hdfs://foo:9000/usr/app/[market]/2009/02/16/data
  hdfs://foo:9000/usr/app/[market]/2009/02/17/data

请阅读文档中的许多示例。很好。

1。About Coordinators

2. DataSet