一、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. 算法排序-lowB三人组

    冒泡排序思路: 选择排序思路: 插入排序思路: 小结: 详细代码解释看下一篇

  2. React_Redux_Router

    一.react_redux 比较好的blog: blog1, blog2, blog3 主要根据前两个blog总结如下: 1. React在组件内部(包括子组件)为单向数据流且自上向下通过props传 ...

  3. php把时间存入数据库为年月日时分秒类型

    时间用now() $sql1 = "insert into registerip (name,logintime,ip,url) values ('1211121',now(),'127.0 ...

  4. 关于erlang中的timer:tc/3

    timer:tc/3对于统计函数运行时间是个很不错的函数, 截图timer:tc/1,tc/2,tc/3的API: 拿斐波那契数列入手做个讲解: -module(fib). -export([fib/ ...

  5. Python中十六进制和字符串的转换(转载)

    调用Python内置int()函数把该字串转为数字.以下为在Python解释器编程环境下的操作示范: 把十六进制的字串转为十进制数字:Python代码>>> print int('f ...

  6. ipa验证错误问题总结

    The following issues were found during validation.这个error的产生原因是因为代码中写的标示符或者方法名,与系统的命名空间冲突. 具体是哪个标示符或 ...

  7. Spring mvc接受集合类型参数的方法

    public String xxxxx(String xxxx, String xxxxx, @RequestParam("parameterList[]") List<St ...

  8. 怎么实现单击span时给span添加边框

    说明: 1.开发环境 vs2012 asp.net mvc4 c# 1.效果图 2.html 前端代码 <%@ Page Language="C#" AutoEventWir ...

  9. Local Response Normalization 60 million parameters and 500,000 neurons

    CNN是工具,在图像识别中是发现图像中待识别对象的特征的工具,是剔除对识别结果无用信息的工具. ImageNet Classification with Deep Convolutional Neur ...

  10. const位置上的不同代表哪些不同的意义

    const位置上的不同代表哪些不同的意义 exern的用法 这个可以引用在程序编译过程中编译进去的常量数据.换句话说正能在.h文件的声明赋值的常量才可以.并且常量的名字不能相同,如果相同会报错. 全局 ...