1.17 shell action
一、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.17 shell action的更多相关文章
- Oozie-自定义实现WorkFlow中shell action
拷贝默认的shell目录来进行修改 $ cp -r ./examples/apps/shell/ my-apps/ 定义job.properties nameNode=hdfs://bigdata-0 ...
- oozie调用java实例------shell action
Oozie提供了一个方便的方式来运行任何命令.这可能是Unix命令,Perl或Python脚本,甚至java程序都可以通过Unix shell调用.shell命令运行在任意的Hadoop集群节点上,并 ...
- Flink整合oozie shell Action 提交任务 带kerberos认证
最近这段时间一直在忙新集群迁移,上了最新的cdh6.3.0 于是Flink 提交遇到了许多的问题 还好有cloudera License 有了原厂的帮助和社区的伙伴,问题解决起来快了不少,手动滑稽 集 ...
- Linux学习笔记(17) Shell编程之基础
1. 正则表达式 (1) 正则表达式用来在文件中匹配符合条件的字符串,正则是包含匹配.grep.awk.sed等命令可以支持正则表达式:通配符用来匹配符合条件的文件名,通配符是完全匹配.ls.find ...
- 17.在Action获取Scope对象
转自:https://wenku.baidu.com/view/84fa86ae360cba1aa911da02.html 引言:在前面的Action操作中,关键就是Action中的exectue方法 ...
- 17 shell break与continue
使用 while.until.for.select 循环时,如果想提前结束循环(在不满足结束条件的情况下结束循环),可以使用 break 或者 continue 关键字. 在C语言.Python.Ja ...
- linux shell基础语法
1.第一个Shell脚本 打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好,如果你用php写shell 脚本,扩展名就用php好了. 输入一些代码 ...
- oozie调用shell
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agree ...
- [CLR via C#]17. 委托
回调函数是一种非常有用的编程机制,它已经存在很多年了.Microsoft .NET Framework通过委托(delegate)来提供一种回调机制.不同于其他平台(比如非托管C++)的回调机 ...
随机推荐
- diff patch
http://rails-deployment.group.iteye.com/group/wiki/1318-diff-and-patch-10-minutes-guide 情景一:你正尝试从代码编 ...
- Apache Server与多个独立Tomcat集成
取经自http://www.ramkitech.com/2012/03/virtual-host-apache-httpd-server-tomcat.html 继续干Tomcat和Apache Se ...
- 通过JAVA调用命令行程序
这是我在把数据导入到数据库时遇到问题,总结下来的.包含两个方法,一个方法是读取文件路径下的文件列表,主方法是执行cmd命令,在导入时想得到导入一个文件的时间,涉及到线程阻塞问题,这个问题理解不是很深, ...
- ACM-BFS之Open the Lock——hdu1195(双向BFS)
这道题的0基础版本号,暴力BFS及题目详情请戳:http://blog.csdn.net/lttree/article/details/24658031 上回书说道,要用双向BFS来尝试一下. 最终A ...
- c#4.5新语法--自动属性和隐式类型
1.自动属性 自动属性是c#中属性定义的两种形式的一种:传统属性定义.自动属性. 1.1 传统属性定义 private int _age; public int ...
- 调用Windows API实现GBK和UTF-8的相互转换
GBK转UTF-8示例 GbkToUtf8.cpp #include <Windows.h> #include <iostream> #include <string&g ...
- Android 属性动画ObjectAnimator和ValueAnimator讲解
区别: ObjectAnimator 是直接对某个view进行更改. ValueAnimator 根据 TimeInterpolator 在不断产生相应的数据,来传进view ,view自己做改变. ...
- 3个CCIE考官对一个高级工程师的面试题
3个CCIE考官对一个高级工程师的面试题 转载 时间:2015-7-10 原文转载: 1.现在的6509及7609,SUP720交换带宽去到720G,是不是可以说7609/6509 可以取代一部分GS ...
- Vue数据双向绑定探究
前面的啰嗦话,写一点吧,或许就有点用呢 使用过vue的小伙伴都会感觉,哇,这个框架对开发者这么友好,简直都要笑出声了. 确实,使用过vue的框架做开发的人都会感觉到,以前写一大堆操作dom,bom的东 ...
- bzoj4485: [Jsoi2015]圈地
思维僵化选手在线被虐 其实应该是不难的,题目明显分成两个集合,要求是不同集合的点不能联通 先假设全选了,然后二分图最小割,相邻两个点直接连墙的费用就可以了 #include<cstdio> ...