Oozie 实战之 shell
说明:使用 shell action 执行 shell 脚本 hive-select-test.sh 来通过已经配置好的 Hive -f 来执行 HQL 查询脚本文件 select.sql
1.创建脚本文件 hive-select-test.sh
!/bin/sh
/opt/cdh5.3.6/hive-1.1.0-cdh5.12.0/bin/hive -f select.sql
2.创建 HQL 文件 select.sql
insert overwrite directory '/user/cen/oozie-apps/shell-hive-select/output/' select count(1) cnt from default.test;
3.修改 job.properties 文件
nameNode=hdfs://cen-ubuntu.cenzhongman.com:8020
jobTracker=localhost:8032
queueName=default
oozieAppsRoot=oozie-apps
oozie.wf.application.path=\({nameNode}/user/cen/\){oozieAppsRoot}/shell-hive-select/
EXEC=hive-select-test.sh
script=select.sql
4.修改 workflow.xml 文件
注意事项
- workflow 版本0,5 sqoop action 版本0.2
- 使用的是新版本的API,但旧版本依旧支持使用(可以不用改)
- 关于file作用和配置,下文会说明
5.上传文件到HDFS文件系统
6.执行程序
export OOZIE_URL=http://cen-ubuntu:11000/oozie/
bin/oozie job --config oozie-apps/shell-hive-select/job.properties -run

浙公网安备 33010602011771号