1.编辑job.propertiers
nameNode=hdfs://cen-ubuntu.cenzhongman.com:8020
jobTracker=localhost:8032
queueName=default
oozieAppsRoot=oozie-apps
oozie.use.system.libpath=true
oozie.wf.application.path=({nameNode}/user/cen/){oozieAppsRoot}/hive-select/
outputDir=hive-select/output
2.添加lib文件夹
3.复制MySQL的API到lib下
4.复制hive-site.xml文件到目录下
5.编辑workflow
<action name="hive-node">
<hive xmlns="uri:oozie:hive-action:0.5">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}/user/cen/${oozieAppsRoot}/${outputDir}"/>
</prepare>
<job-xml>${nameNode}/user/cen/${oozieAppsRoot}/hive-select/hive-site</job-xml>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<script>select.sql</script>
<param>OUTPUT=/user/cen/${oozieAppsRoot}/${outputDir}</param>
</hive>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Hive failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
注意事项(对比example文件)
- 更新版本两个
- 无需使用新api
- 添加
({nameNode}/user/cen/){oozieAppsRoot}/hive-select/hive-site 用以说明配置文件位置 - 添加指明SQL文件
- 添加OUTPUT=/user/cen/({oozieAppsRoot}/){outputDir}说明输出目录[可选]
6.上传文件
7.执行文件
export OOZIE_URL=http://cen-ubuntu:11000/oozie/
bin/oozie job -config oozie-apps/hive-select/job.properties -run