-
cp -r examples/apps/shell oozie-apps/
-
mv shell shell-hive-select
-
touch student-select.sh
#!/usr/bin/env bash
+ ##student select
/opt/cdh5.3.6/hive-0.13.1-cdh5.3.6/bin/hive -f student-select.sql
-
vi student-select.sql
insert overwrite directory '/user/beifeng/oozie/datas/shell-hive-select/output'
select dept_no,dept_name from default.dept;
-
job.properties
nameNode=hdfs://hadoop-senior.beifeng.com:8020
jobTracker=hadoop-senior.beifeng.com:8032
queueName=default
examplesRoot=examples
oozieAppsRoot=user/beifeng/oozie-apps
oozieDataRoot=user/beifeng/oozie/datas
oozie.wf.application.path=${nameNode}/${oozieAppsRoot}/shell-hive-select/
EXEC=student-select.sh
script=student-select.sql
-
workflow.xml
<workflow-app xmlns="uri:oozie:workflow:0.5" 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>${nameNode}/${oozieAppsRoot}/shell-hive-select/${EXEC}#${EXEC}</file>
<file>${nameNode}/${oozieAppsRoot}/shell-hive-select/${script}#${script}</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>
- 查看运行日志
http://hadoop-senior.beifeng.com:19888/jobhistory/logs/hadoop-senior.beifeng.com:49066/container_1521081924307_0045_01_000002/attempt_1521081924307_0045_m_000000_0/beifeng
-
查看运行结果
bin/hdfs dfs -text /user/beifeng/oozie/datas/shell-hive-select/output/*
网友评论