其他分享
首页 > 其他分享> > HUE中Oozie执行Hive脚本

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>

  

 

标签:HUE,string,int,hive2,spider,Hive,参数,Oozie,date
来源: https://www.cnblogs.com/EnzoDin/p/10548429.html