zoukankan      html  css  js  c++  java
  • HUE中Oozie执行Hive脚本

    Oozie执行hive,传入参数
    1. 新建一个workflow

    2. 拖入一个hive2

    3. hive脚本如下

    CREATE TABLE IF NOT EXISTS spider_tmp.org_invest_fund_${date} (
    `id` int, 
    `info_id` int, 
    `company` string, 
    `company_url` string, 
    `legal_person` string, 
    `reg_capital` string, 
    `establish_date` string, 
    `investor` string, 
    `update_time` string)
    ROW FORMAT DELIMITED
    FIELDS TERMINATED BY '`'
    STORED AS TEXTFILE;

    注意,此处${date}表示需要执行时传入的参数
    4. 添加参数

    5. 启动,填入参数即可

    6.workflow.xml如下

    <workflow-app name="Workflow_hive" xmlns="uri:oozie:workflow:0.5">
        <start to=" hive-table_load_data "/>
        <kill name="Kill">
            <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
        </kill> 
        <action name="hive-table_load_data" cred="hive2">
            <hive2 xmlns="uri:oozie:hive2-action:0.1">
                <job-tracker>${jobTracker}</job-tracker>
                <name-node>${nameNode}</name-node>
                <jdbc-url>jdbc:hive2://hadoop1:10000/spider_tmp</jdbc-url>
                <script>/user/fengz/xxxx.q</script>
                <param>date=${date}</param>
            </hive2>
            <ok to="End"/>
            <error to="Kill"/>
        </action>
        <end name="End"/>
    </workflow-app>

      

  • 相关阅读:
    web项目获取spring的applicationContext方式一
    idea关于tomcat中文乱码问题
    java面试题02
    JDBC连接步骤(三)
    JDBCAPI简介(二)
    JDBC简介(一)
    Maven(三)archetype
    如何javaSwing关闭子窗口不关闭父窗口
    Java中Object转化为int类型
    java double转int
  • 原文地址:https://www.cnblogs.com/EnzoDin/p/10548429.html
Copyright © 2011-2022 走看看