关于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时间时,要改成这个时区的格式。

猜你喜欢

转载自tangjunliang.iteye.com/blog/1936668