一、Hive Action

1、创建文件

[root@hadoop-senior oozie-apps]# pwd
/opt/cdh-5.3.6/oozie-4.0.0-cdh5.3.6/oozie-apps [root@hadoop-senior oozie-apps]# mkdir hive-select ##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.use.system.libpath=true oozie.wf.application.path=${nameNode}/${oozieAppsRoot}/hive-select/ outputDir=hive-select/output ##workflow.xml
<workflow-app xmlns="uri:oozie:workflow:0.5" name="wf-hive-select">
<start to="hive-node"/> <action name="hive-node">
<hive xmlns="uri:oozie:hive-action:0.5">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}/${oozieDataRoot}/${outputDir}"/>
</prepare>
<job-xml>${nameNode}/${oozieAppsRoot}/hive-select/hive-site.xml</job-xml>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<script>select-student.sql</script>
<param>OUTPUT=${nameNode}/${oozieDataRoot}/${outputDir}</param>
</hive>
<ok to="end"/>
<error to="fail"/>
</action> <kill name="fail">
<message>Hive failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>


##参数注释
<job-xml>${nameNode}/${oozieAppsRoot}/hive-select/hive-site.xml</job-xml>       //指定hive-site.xml文件的路径,因为运行hive action要读取hive的配置
<script>select-student.sql</script>                                             //指定要运行的sql脚本,默认和workflow.xml在同一目录下

2、上传到hdfs

##[root@hadoop-senior hive-select]# vim select-student.sql        //内容如下
insert overwrite directory '${OUTPUT}' select
count(1) cnt
from default.student ; ##
[root@hadoop-senior oozie-apps]# cp /opt/cdh-5.3.6/hive-0.13.1-cdh5.3.6/conf/hive-site.xml hive-select/ ##
[root@hadoop-senior oozie-apps]# mkdir hive-select/lib [root@hadoop-senior oozie-apps]# cp /opt/softwares/mysql-libs/mysql-connector-java-5.1.27/mysql-connector-java-5.1.27-bin.jar hive-select/lib/ ##上传到hdfs
[root@hadoop-senior oozie-apps]# /opt/cdh-5.3.6/hadoop-2.5.0-cdh5.3.6/bin/hdfs dfs -put hive-select/ /user/root/oozie-apps

3、运行oozie job

##
[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/hive-select/job.properties -run

1.13-1.14 Hive Action的更多相关文章

  1. Thinkpad W520 + Ubuntu 12.04LTS, 13.10, 14.04LTS安装Nvidia显卡驱动设置

    Thinkpad W520 + Ubuntu 12.04LTS, 13.10, 14.04LTS安装Nvidia显卡驱动设置 http://henzhai.com/tech/2012/07/w520- ...

  2. 升级MAC OS到10.13, 10.14系统后UNITY工程无法加载资源的解决办法

    升级MAC OS到10.13, 10.14系统后,出现UNITY工程无法加载资源的情况: Unity项目中Asset目录显示为空! 解决办法一: 打开Launchpad中的磁盘工具 (也就是实用工具下 ...

  3. JavaScript高级程序设计(第三版)学习笔记13、14章

    第13章,事件 事件冒泡 IE的事件叫做事件冒泡:由具体到不具体 <!DOCTYPE html> <html> <head>      <title>E ...

  4. [团队项目]第二个冲刺 看板和燃尽图 Sprint2 6.8/6.9/6.10/6.11/6.12/6.13/6.14

    1.开始一个新的冲刺: 起止:2016.6.1~2016.6.14 按照以下过程进行 ProductBacklog:继续向下细化 Sprint 计划会议:确定此次冲刺要完成的目标 Sprint Bac ...

  5. EC读书笔记系列之8:条款13、14、15

    条款13 以对象管理资源 记住: ★为防止资源泄漏,请使用RAII对象,它们在构造函数中获得资源并在析构函数中释放 ★两个常被使用的RAII classes分别是tr1::shared_ptr和aut ...

  6. RH033读书笔记(13)-Lab 14 Network Clients

    Goal: Practice using a variety of tools to transfer files between your system and a remote system. S ...

  7. 12,13,14节-51单片机ESP8266学习-AT指令(暂停更新)需要整理

    从这一节开始,以视频加源码的形式,后期视频和程序将放在链接中 资料链接 链接: https://pan.baidu.com/s/1jpHZjW_7pQKNfN9G4B6ZjA     密码:nhn3  ...

  8. 阅读<构建之法>13、14、15、16、17章

    13章 这么多测试为什么不能整理出一个包括所有功能的测试呢?看着那么多测试都感觉奇怪了. 14章 怎样才能体现一个测试人员的工作价值呢?这样的判断又是否会太独断了? 15章 在时间上,会不会因不同功能 ...

  9. intellij idea 13&amp;14 插件推荐及高速上手建议 (已更新!)

    早些年 在外企的时候,公司用的是intellij idea ,当时也是从eclipse.MyEclipse转过去的非常是不习惯. 用了一周明显感觉爱上它了.由于它非常智能,并且能纠正你非常多不好的习惯 ...

随机推荐

  1. liunx安装redis和gcc

    首先去上下载redis,我现在用的版本是:redis-3.0.4.tar.gz 然后放到虚拟机里面解压,下面是三种解压命令: tar -zxvf file.tar.gz tar -jcvf file ...

  2. 机器学习资源汇总----来自于tensorflow中文社区

    新手入门完整教程进阶指南 API中文手册精华文章TF社区 INTRODUCTION 1. 新手入门 1.1. 介绍 1.2. 下载及安装 1.3. 基本用法 2. 完整教程 2.1. 总览 2.2.  ...

  3. libraries_v140_x64_py35_1.0.1.tar.bz2 libraries_v120_x64_py27_1.1.0.tar 下载链接以及百度云下载链接

    下载链接 wget  -c  https://github.com/willyd/caffe-builder/releases/download/v1.0.1/libraries_v140_x64_p ...

  4. Scala随记

    使用Scala首先确保本地Java 8版本,然后按照官网所说,比较流行的方式(1) sbt; (2) IDE "The most popular way to get Scala is ei ...

  5. 自动提交form表单

    <form class="form-inline" name='MD5form' method="post" action="<?php ...

  6. Go怎么获取当前时间? Go ARM64 vDSO优化之路

    https://mzh.io/ Go ARM64 vDSO优化之路 2018-03-16  | Meng Zhuo 背景 Go怎么获取当前时间?问一个会Go的程序员,他随手就能写这个出来给你. imp ...

  7. tornado之表单和模板

    之前在indexHandler中通过self.write()方法在对应的网页中写入具体的字符信息. 如果我们想直接返回一个网页那么这个时候就需要用到模板了 首先在工程目录下新建一个template文件 ...

  8. Linux环境编程之同步(三):读写锁

    概述 相互排斥锁把试图进入我们称之为临界区的全部其它线程都堵塞住.该临界区通常涉及对由这些线程共享一个或多个数据的訪问或更新.读写锁在获取读写锁用于读某个数据和获取读写锁用于写直接作差别. 读写锁的分 ...

  9. Perl 正则表达式语法

    1. 概要 Perl正则表达式是Boost.regex 默认行为,也可以将perl传入basic_regex 构造. boost::regex  e1(my_expression); boost::r ...

  10. (linux)BSP板级支持包开发理解

    1. 概述 嵌入式系统由硬件环境.嵌入式操作系统和应用程序组成,硬件环境是操作系统和应用程序运行的硬件平台,它随应用的不同而有不同的要求.硬件平台的多样性是嵌入式系统的主要特点,如何使嵌入式操作系统在 ...