问题
I'm using Oozie to string together a set of MapReduce jobs. The individual stubs for each job are about 400 lines long due to requiring lots of properties. Most of these properties are identical between jobs, and use configuration set in config-default.xml. I want to be able to shorten each stub and centralise the common properties, as it's getting pretty impractical to have to work out which properties are common when creating a new job.
The obvious solution is to shorten my workflows by placing the common properties in a job.xml file called in each stub with a job-xml tag. However, job.xml doesn't seem to read config-default.xml, so the variables aren't resolved in job.xml. I can't use config-default.xml in a job-xml tag, as it itself contains variables which are set in job.properties.
Any suggestions? Having a bash script run and manually replace the variables is not a solution I could use.
回答1:
You can shorten your workflow xml by using Global configurations
This way you can put all the join properties in the global section, it look something like this:
<workflow-app xmlns="uri:oozie:workflow:0.4" name="wf-name">
<global>
<job-tracker>${job-tracker}</job-tracker>
<name-node>${namd-node}</name-node>
<job-xml>job1.xml</job-xml>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
</global>
Note: make sure that you use the right workflow version (in my example it's 0.4)
来源:https://stackoverflow.com/questions/24327264/shortening-oozie-workflows