一、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的更多相关文章

  1. Oozie-自定义实现WorkFlow中shell action

    拷贝默认的shell目录来进行修改 $ cp -r ./examples/apps/shell/ my-apps/ 定义job.properties nameNode=hdfs://bigdata-0 ...

  2. oozie调用java实例------shell action

    Oozie提供了一个方便的方式来运行任何命令.这可能是Unix命令,Perl或Python脚本,甚至java程序都可以通过Unix shell调用.shell命令运行在任意的Hadoop集群节点上,并 ...

  3. Flink整合oozie shell Action 提交任务 带kerberos认证

    最近这段时间一直在忙新集群迁移,上了最新的cdh6.3.0 于是Flink 提交遇到了许多的问题 还好有cloudera License 有了原厂的帮助和社区的伙伴,问题解决起来快了不少,手动滑稽 集 ...

  4. Linux学习笔记(17) Shell编程之基础

    1. 正则表达式 (1) 正则表达式用来在文件中匹配符合条件的字符串,正则是包含匹配.grep.awk.sed等命令可以支持正则表达式:通配符用来匹配符合条件的文件名,通配符是完全匹配.ls.find ...

  5. 17.在Action获取Scope对象

    转自:https://wenku.baidu.com/view/84fa86ae360cba1aa911da02.html 引言:在前面的Action操作中,关键就是Action中的exectue方法 ...

  6. 17 shell break与continue

    使用 while.until.for.select 循环时,如果想提前结束循环(在不满足结束条件的情况下结束循环),可以使用 break 或者 continue 关键字. 在C语言.Python.Ja ...

  7. linux shell基础语法

    1.第一个Shell脚本 打开文本编辑器,新建一个文件,扩展名为sh(sh代表shell),扩展名并不影响脚本执行,见名知意就好,如果你用php写shell 脚本,扩展名就用php好了. 输入一些代码 ...

  8. oozie调用shell

    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agree ...

  9. [CLR via C#]17. 委托

        回调函数是一种非常有用的编程机制,它已经存在很多年了.Microsoft .NET Framework通过委托(delegate)来提供一种回调机制.不同于其他平台(比如非托管C++)的回调机 ...

随机推荐

  1. Webkit二:RenderTree 创建

    RenderObject 作为所有Render 树节点的基类,完全类似与DOM树中的Node基类,它是构成Render 树的基础,作用非比寻常,其中包含了构成Render 树所可能涉及到的一些基本属性 ...

  2. Linux 中权限的再讨论( 上 )

    前言 在Linux系统中,用户分为三个部分( 所有者 同组人 其他 ).每个部分的权限又可以赋予读/写/执行权限.这样,文件的权限标记一共包含 9 个权限位.好了,很多朋友对于Linux权限的了解就仅 ...

  3. 基于TCP的一对回射客户/服务器程序及其运行过程分析( 下 )

    执行分析 1. 打开服务器进程: 2. 执行netstat -a命令观察当前的连接状态: 第1条连接记录说明:绑定了本地主机的任意IP,端口为9877,目前处于监听状态. 3. 打开客户进程: 4. ...

  4. 更改UISearchBar button属性

    //点击搜索框时触发 - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { self.theSearchUserSearchBa ...

  5. Git Xcode配置

    本文转载至 http://www.cnblogs.com/imzzk/p/xcode_git.html 感谢作者分享 Git源代码管理工具的出现,使得我们开发人员对于源码的管理更加方便快捷.至于Git ...

  6. C# wince 实现软件忙鼠标状态改变

    eg: Cursor.Current = Cursors.WaitCursor; dosomething(); Cursor.Current = Cursors.Default; Cursor.Cur ...

  7. EasyDarwin开源流媒体云平台之语音对讲功能设计与实现

    本文由EasyDarwin开源团队成员Alex贡献:http://blog.csdn.net/cai6811376/article/details/52006958 EasyDarwin云平台一直在稳 ...

  8. Understanding Unicorn and unicorn-worker-killer Unicorn

    We just wrote some new documentation on how Gitlab uses Unicorn and unicorn-worker-killer, available ...

  9. hsv hsb rgb lab

    lab  欧式距离 反映 人类所能感受到的这两种颜色的差异

  10. Xcode6 新特性

    苹果在WWDC 2014上对新版Xcode(Xcode 6 Beta版)并没有提及过多.但它却是开发人员不能忽视的一部分.Xcode 6 Beta版为设计和创建软件引入了新方法,更加关注功能和一些改善 ...