oozie案例——自定義shell workflow


相關運行命令

運行一個應用:
bin/oozie job -oozie http://hadoop-1:11000/oozie -config examples/apps/map-reduce/job.properties -run

殺掉一個job
bin/oozie job -oozie http://hadoop-1:11000/oozie  -kill 0000001-160702224410648-oozie-beif-W

查看job的日志信息
bin/oozie job -oozie http://hadoop-1:11000/oozie -log 0000001-160702224410648-oozie-beif-W

查看job的信息
bin/oozie job -oozie http://hadoop-1:11000/oozie -info 0000001-160702224410648-oozie-beif-W

 1.定義job.properties

nameNode=hdfs://hadoop-1:9000
jobTracker=hadoop-1:8032
queueName=default
ShellRoot=free-shell

oozie.wf.application.path=${nameNode}/user/${user.name}/${ShellRoot}
EXEC=free.sh

2. 定義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>${EXEC}</exec>
            <file>/user/hadoop/free-shell/${EXEC}#${EXEC}</file>
        </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>

3. free.sh定義shell腳本

#!/bin/bash

/usr/bin/free -m >> /tmp/free.log
/bin/date >> /tmp/free.log

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM