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