1

我想安排一个基于文件夹的oozie作业,即如何安排OOZIE作业,如果在给定文件夹中发生任何更改?

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

我想安排一个OOZIE批处理,如果有任何新文件添加到该文件夹​​中。

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

在此先感谢。

回答

1

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

您可以使用Oozie的协调员来检查数据的依赖,并触发Oozie的工作流程协调员EL functions 在每一天您的文件被添加到该HDFS与timestamp.So与数据集,你可以实现你的情况。

从文档

00:15 PST8PDT每天产生一次做标志设置为空的数据集:

<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 

请阅读文档的例子很多在那里给它。它很好。

About Coordinators 1.

2. DataSet