一、shell action

1、

##job.properties
nameNode=hdfs://hadoop-senior.ibeifeng.com:8020
jobTracker=hadoop-senior.ibeifeng.com:8032
queueName=default
oozieAppsRoot=user/root/oozie-apps
oozieDataRoot=user/root/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>
<capture-output/>
</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> ##student-select.sh
#!/usr/bin/env bash ## student select
/opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6/bin/hive -f student-select.sql ##student-select.sql
insert overwrite directory '/user/root/oozie/datas/shell-hive-select/output'
select
id, name
from default.student ;
prepare元素里面配置启动job前要删除或者创建的文件夹,文件夹路径必须是以hdfs://HOST:PORT开头。

job-xml指定一个存在的配置文件。

configuration里面配置传递给sqoop job的参数。

exec元素包含要执行的shell命令的路径。可以给shell命令添加参数。

argument元素指定要传递给shell脚本的参数。

env-var包含传递给shell命令的环境变量。env-var只能包含一个环境变量和值。如果这个环境变量包含像$PATH一样的,那它必须写成PATH=$PATH:mypath。不能用${PATH},因为它将会被EL解析。

capture-output元素指定用来捕获shell脚本的标准输出。可以通过String action:output(String node, String key)函数【EL函数】来获得输出。

<file>属性会复制指定的文件到运行该脚本的机器上。

2、运行

##
[root@hadoop-senior oozie-apps]# /opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6/bin/hdfs dfs -put shell-hive-select/ /user/root/oozie-apps/ ##
[root@hadoop-senior oozie-4.0.0-cdh5.3.6]# export OOZIE_URL=http://hadoop-senior.ibeifeng.com:11000/oozie/ [root@hadoop-senior oozie-4.0.0-cdh5.3.6]# bin/oozie job -config oozie-apps/shell-hive-select/job.properties -run

最新文章

  1. Selenium 2 入门
  2. 教你写一个web远程控制小工具
  3. PHP 面向对象编程
  4. 装了个干净的win7
  5. Linux基础(7)
  6. js接收html传值
  7. mysql4 - 高级操作
  8. Android官方推荐使用DialogFragment替换AlertDialog
  9. Linux系统监控命令详解
  10. jsTree使用
  11. css 实现的网页布局
  12. Scrapy爬取美女图片第三集 代理ip(上) (原创)
  13. windows10 激活方法
  14. [Jobdu] 题目1545:奇怪的连通图
  15. 201621123010《Java程序设计》第4周学习总结
  16. ansible入门七(实战)
  17. Shiro 集成Spring 使用 redis时 使用redisTemplate替代jedisPool(五)
  18. python学习笔记二:if语句及循环语句,断点,模块,pyc
  19. Hibernate 入门示例
  20. POJ 1160 Post Office (四边形不等式优化DP)

热门文章

  1. 笔记12 export to excel (NPOI)
  2. vim 模式切换
  3. RFID 卡片防复制
  4. 04 http协议模拟登陆发帖
  5. [学些东西]用爬虫练习网站来练习burp suite
  6. CSS伪类:before 和 :after
  7. uva 10733 The Colored Cubes&lt;polya定理&gt;
  8. Java类加载器( 死磕 4)
  9. I NEED A OFFER! hdu1203
  10. 解决Windows x64bit环境下无法使用PLSQL Developer连接到Oracle DB中的问题