- 拷贝默认的shell目录来进行修改
$ cp -r ./examples/apps/shell/ my-apps/
- 定义job.properties
nameNode=hdfs://bigdata-00:8020 jobTracker=bigdata-00:8032 queueName=default examplesRoot=user/wulei/my-apps/shell #定义workflow.xml路劲 oozie.wf.application.path=${nameNode}/${examplesRoot}/workflow.xml #定义一个变量名存储shell文件名 EXEC=oozie.sh
- 定义workflow.properties
<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> <!-- 定义shell脚本路劲 --> <file>${nameNode}/${examplesRoot}/${EXEC}#${EXEC}</file> <!--Copy the executable to compute node's current working directory --> </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>
- 定义要实现的脚本
- 上传到hdfs后运行
- 查看运行结果