1. 程式人生 > >關於oozie時區的設定

關於oozie時區的設定

oozie版本:oozie-4.0.0-cdh5.0.0-beta-1      oozie預設的時區是UTC,所以我們在定時跑任務的時候,如果設定的時間是當前時間,發現JOB並不會跑起來,而是處於PREA狀態。如果需要JOB按照我們的設定的時間去跑該如何設定?     我們在配置任務的時候,在coordinator.xml中,有時區的配置,預設是timezone="UTC",當我們把它改成,啟動我們的JOB,發現這個配置並沒有起作用。     開啟oozie的配置檔案oozie-default.xml,我們發現有以下的一個配置:

<property>
<name>oozie.processing.timezone</name>
<value>UTC</value>
<description>
 Oozie server timezone. Valid values are UTC and GMT(+/-)####, for example 'GMT+0530' would be India
 timezone. All dates parsed and genered dates by Oozie Coordinator/Bundle will be done in the specified
 timezone. The default value of 'UTC' should not be changed under normal circumtances. If for any reason
 is changed, note that GMT(+/-)#### timezones do not observe DST changes.
</description>
</property>
我們把它的配置值改成GMT+0800後,重新啟動OOZIE服務,再啟動我們的JOB,發現這個配置還是不起作用。     後來發現在OOZIE的啟動日誌中:
2013-09-05 09:27:06,546 INFO XLogService:539 -
*******************************************************************************
 STARTUP MSG: Oozie BUILD_VERSION [3.3.2-cdh4.3.0] compiled by [jenkins] on [2013.05.28-03:57:35GMT]
 STARTUP MSG: revision [unavailable]@[unavailable]
*******************************************************************************
2013-09-05 09:27:06,558 INFO XLogService:539 - Log4j configuration file [oozie-log4j.properties]
2013-09-05 09:27:06,560 INFO XLogService:539 - Log4j configuration file loaded from [/dw/oozie/conf]
2013-09-05 09:27:06,561 INFO XLogService:539 - Log4j reload interval [10 sec]
2013-09-05 09:27:06,589 INFO ConfigurationService:539 - USER[-] GROUP[-] Oozie home dir [/dw/oozie]
2013-09-05 09:27:06,590 INFO ConfigurationService:539 - USER[-] GROUP[-] Oozie conf dir [/dw/oozie/conf]
2013-09-05 09:27:06,593 INFO ConfigurationService:539 - USER[-] GROUP[-] Oozie conf file [oozie-site.xml]
發現oozie載入了oozie-site.xml這個配置檔案,並沒有載入oozie-default.xml,難道是這個原因? 是的,原因在oozie的CDH版本的官方文件中說oozie-default.xml這個檔案不會被oozie使用,僅作為一個參考。 所以就把這段程式碼拷貝到了oozie-site.xml的配置中:
<property>
<name>oozie.processing.timezone</name>
<value>GMT+0800</value>
<description>
 Oozie server timezone. Valid values are UTC and GMT(+/-)####, for example 'GMT+0530' would be India
 timezone. All dates parsed and genered dates by Oozie Coordinator/Bundle will be done in the specified
 timezone. The default value of 'UTC' should not be changed under normal circumtances. If for any reason
 is changed, note that GMT(+/-)#### timezones do not observe DST changes.
</description>
</property>
重啟oozie服務,JOB可以按照當前時間正常跑起來了。 注意:由於使用了GMT+0800,因此在設定start和end時間時,要改成這個時區的格式。