大数据协作框架

Oozie WorkFlow中Shell Action使用案例

2018-04-06  本文已影响61人  明明德撩码
#!/usr/bin/env bash

+ ##student select
/opt/cdh5.3.6/hive-0.13.1-cdh5.3.6/bin/hive -f student-select.sql

insert overwrite directory '/user/beifeng/oozie/datas/shell-hive-select/output'
select dept_no,dept_name from default.dept; 

nameNode=hdfs://hadoop-senior.beifeng.com:8020
jobTracker=hadoop-senior.beifeng.com:8032
queueName=default
examplesRoot=examples
oozieAppsRoot=user/beifeng/oozie-apps
oozieDataRoot=user/beifeng/oozie/datas

oozie.wf.application.path=${nameNode}/${oozieAppsRoot}/shell-hive-select/
EXEC=student-select.sh
script=student-select.sql
<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>
        </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>
http://hadoop-senior.beifeng.com:19888/jobhistory/logs/hadoop-senior.beifeng.com:49066/container_1521081924307_0045_01_000002/attempt_1521081924307_0045_m_000000_0/beifeng
bin/hdfs dfs -text /user/beifeng/oozie/datas/shell-hive-select/output/*
上一篇 下一篇

猜你喜欢

热点阅读