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

相關問題