Oozie configuration instructions for timing scheduling first article

Source: Internet
Author: User
Tags constant current time datetime string format xmlns ssh

If you need to do a recurring scheduled schedule, the basic need for three files

Job.properties records the job's properties workflow.xml use HPDL to define the process of the task and the branch coordinator.xml mainly used to do the workflow trigger conditions, to do timed triggering, You can also combine the run order of multiple workflow
Now to explain a simple demo, ooize to explain job.properties the file is mainly set some parameter information and common variables # cluster parameters #nameNode地址
namenode=hdfs://master:8020 #resourceManager地址
jobtracker=master:8032 #oozie队列 This property is generally not modified Queuename=default
# oozie #coordinator. xml Path on HDFs
Oozie.coord.application.path=${namenode}/work/coordinator.xml #workflow. xml Path on HDFs
Workflowappuri=${namenode}/work/workflow.xml #workflow的名字
Workflowname=workflow #定时任务的开始时间 in UTC time Zone
start=2016-11-03t09:00z #定时任务的结束时间
end=2019-07-30t16:00z
# The path where the shell script is located or the jar package that needs to be executed
Jarsdir=/home/jar
# The host where the shell script resides or the jar package that needs to be executed
Sshhost=namenode2


Workflow.xml <workflow-app xmlns= "uri:oozie:workflow:0.2" Name= "${workflowname}" > <start to= "SchedulerMain "/>--the name of the action launched
<action name= "Schedulermain" >
<ssh xmlns= "uri:oozie:ssh-action:0.1" >--the action node means to log on to a machine and execute a shell command
<command>hadoop jar ${jarsdir}/schedulermain.jar</command>--specific script to execute
</ssh>
<ok to= "End"/>-node to jump after successful execution
<error to= "fail"/>--node to jump after execution failure
</action>
<kill name= "fail" >
<message>java failed, error Message[${wf:errormessage (Wf:lasterrornode ())}]</message>
</kill>
<end name= "End"/>
</workflow-app>
Coordinator.xml
#frequency执行频率 ${coord:minutes (5)} is a coordinator built-in El function (Expression Language) <coordinator-app name= " Coordinator "frequency=" ${coord:minutes (5)} "start=" ${start} "end=" ${end} "timezone=" UTC "xmlns=" Uri:oozie: coordinator:0.2 ">
<action>
<workflow>
<app-path>${workflowAppUri}</app-path>
<configuration>
<property>
<name>jobTracker</name>
<value>${jobTracker}</value>
</property>
<property>
<name>nameNode</name>
<value>${nameNode}</value>
</property>
<property>
<name>queueName</name>
<value>${queueName}</value>
</property>
</configuration>
</workflow>
</action>
</coordinator-app>

EL constant

Constant representation Meaning description
${coord:minutes (int n)} return datetime: From the beginning, the cycle executes n minutes
${coord:hours (int n)} return datetime: From the beginning, the cycle executes n * 60 Minutes
${coord:days (int n)} return datetime: From the beginning, the cycle executes n * 24 * 60 Minutes
${coord:months (int n)} return datetime: From the beginning, the cycle executes n * M * 24 * 60 Minutes (M represents one months of the number of days)
${coord:endofdays (int n)} return datetime: Starting from the latest time of day (i.e. the next day), Cycle execution n * 24 * 60 Minutes
${coord:endofmonths (1)} return datetime: Starting at the latest of the current month (i.e. early next month), Cycle execution n * 24 * 60 Minutes
${coord:current (int n)} return datetime: Start calculation when a coordinator action (action) is created, nth DataSet instance execution time
${coord:datain (String name)} In the input event (input-events), parse all the URIs that the DataSet instance contains
${coord:dataout (String name)} In the output event (output-events), parse all the URIs that the DataSet instance contains
${coord:offset (int n, String timeunit)} Represents the time offset, if a coordinator action is created with a positive number of t,n to be shifted after the moment T, N is offset before the negative to the moment T, Timeunit represents the time unit (option has minute, HOUR, Day, MONTH, year)
${coord:hoursinday (int n)} Specifies the number of hours of the nth Day, n>0 represents the number of hours in the N-day, n=0 represents the number of hours in the day, and N<0 indicates the number of hours of the first n days of the forward number
${coord:daysinmonth (int n)} Specifies the number of days in the nth month, n>0 represents the number of days to the nth month, n=0 represents the number of days in the current month, and n<0 represents the number of days in the first n months
${coord:tzoffset ()} Ataset the number of minutes that correspond to the time zone of the coordinator job
${coord:latest (int n)} Recently, the nth DataSet instance currently available
${coord:future (int n, int limit)} The dataset instance after the current time, n>=0, which represents the immediately available dataset instance when n=0, and the limit represents the number of dataset instances
${coord:nominaltime ()} The nominal time equals the coordinator job start time, plus the number of times the coordinator job is given a DateTime. For example: start= "2009-01-01t24:00z", end= "2009-12-31t24:00z", frequency= "${coord:days (1)}", frequency= "${coord:days (1)}, Then the nominal time is: 2009-01-02t00:00z, 2009-01-03t00:00z, 2009-01-04t00:00z 、...、 2010-01-01t00:00z
${coord:actualtime ()} The actual creation time of the coordinator action. For example: start= "2011-05-01t24:00z", end= "2011-12-31t24:00z", frequency= "${coord:days (1)}", the actual time is: 2011-05-01, 2011-05-02,2011-05-03,...,2011-12-31
${coord:user ()} The name of the user who started the current coordinator job
${coord:dateoffset (string basedate, int instance, string timeunit)} Formula for calculating new datetime: Newdate = basedate + instance * Timeunit, such as: basedate= ' 2009-01-01t00:00z ', instance= ' 2′,timeunit= ' MONTH ', the new date time calculated is ' 2009-03-01t00:00z '.
${coord:formattime (string timeStamp, string format)} Format time string, format specifies pattern
Oozie job-config/root/app/job.properties-run start Oozie execute a specific configuration file


Article reference list: http://blackproof.iteye.com/blog/1928122
Http://shiyanjun.cn/archives/684.html
Http://www.cnblogs.com/en-heng/p/5581331.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.