1.17 shell action
2024-09-24 08:32:14
一、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
最新文章
- Selenium 2 入门
- 教你写一个web远程控制小工具
- PHP 面向对象编程
- 装了个干净的win7
- Linux基础(7)
- js接收html传值
- mysql4 - 高级操作
- Android官方推荐使用DialogFragment替换AlertDialog
- Linux系统监控命令详解
- jsTree使用
- css 实现的网页布局
- Scrapy爬取美女图片第三集 代理ip(上) (原创)
- windows10 激活方法
- [Jobdu] 题目1545:奇怪的连通图
- 201621123010《Java程序设计》第4周学习总结
- ansible入门七(实战)
- Shiro 集成Spring 使用 redis时 使用redisTemplate替代jedisPool(五)
- python学习笔记二:if语句及循环语句,断点,模块,pyc
- Hibernate 入门示例
- POJ 1160 Post Office (四边形不等式优化DP)
热门文章
- 笔记12 export to excel (NPOI)
- vim 模式切换
- RFID 卡片防复制
- 04 http协议模拟登陆发帖
- [学些东西]用爬虫练习网站来练习burp suite
- CSS伪类:before 和 :after
- uva 10733 The Colored Cubes<;polya定理>;
- Java类加载器( 死磕 4)
- I NEED A OFFER! hdu1203
- 解决Windows x64bit环境下无法使用PLSQL Developer连接到Oracle DB中的问题