Oozie WorkFlow中Shell Action使用案例

  • cp -r examples/apps/shell oozie-apps/

  • mv shell shell-hive-select

  • touch student-select.sh

#!/usr/bin/env bash

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

  • vi student-select.sql

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

  • job.properties

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.xml


    
    
        
            ${jobTracker}
            ${nameNode}
            
                
                    mapred.job.queue.name
                    ${queueName}
                
            
            ${EXEC}
            ${nameNode}/${oozieAppsRoot}/shell-hive-select/${EXEC}#${EXEC}
            ${nameNode}/${oozieAppsRoot}/shell-hive-select/${script}#${script}
        
        
        
    
   
    
        Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]
    
    
    

  • 查看运行日志
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/*

你可能感兴趣的:(Oozie WorkFlow中Shell Action使用案例)