HUE中Oozie執行Hive腳本

Oozie執行hive,傳入參數
1. 新建一個workflownode

 

2. 拖入一個hive2api

 

3. hive腳本以下app

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. 添加參數ide

5. 啓動,填入參數便可oop

 

6.workflow.xml以下url

<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>
相關文章
相關標籤/搜索