关于oozie调用shell的一个例子

完成的功能,执行t.sh,并且通过workflow像t.sh传递参数

workflow.xml

<workflow-app xmlns="uri:oozie:workflow:0.4" name="shell-wf">
    <start to="shell-node"/>
    <action name="shell-node">
        <shell xmlns="uri:oozie:shell-action:0.2">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <exec>t.sh</exec>
            <argument>/dp/bin/test.sh</argument>
            <file>t.sh</file> <!--Copy the executable to compute node's current working directory -->
            <capture-output/>
        </shell>
        <ok to="end"/>
        <error to="fail"/>
    </action>
    <kill name="fail">
        <message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>


job.properties

nameNode=hdfs://oozie
jobTracker=master1:8032
queueName=default
exampleRoot=example

oozie.wf.application.path=${nameNode}/user/${user.name}/${exampleRoot}/apps/shell/test


a.sh

ssh hadoop@master2 ${1}

猜你喜欢

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