使用Oozie执行shell脚本,作业始终只在运行状态

时间:2015-05-07 05:11:52

标签: shell hadoop oozie

我需要oozie的帮助,我正在尝试运行创建HDFS文件夹的脚本,当我执行Oozie时它只显示在Running状态,有人可以帮我识别我的workflow.xml有什么问题或jo.properties。我尝试验证了workflow.xml,但没有显示任何错误。

workflow.xml

<workflow-app xmlns='uri:oozie:workflow:0.3' name='shell-wf'>
  <start to='shell1' />
  <action name='shell1'>
 <shell xmlns="uri:oozie:shell-action:0.1">
  <job-tracker>${jobTracker}</job-tracker> 
  <name-node>${nameNode}</name-node> 
  <exec>/user/nathalok/run.sh</exec>  
  <file>/user/nathalok/run.sh#run.sh</file> 
  </shell>
       <ok to="end" />
        <error to="fail" />
    </action>
    <kill name="fail">
        <message>Script failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name='end' />
</workflow-app>

Job.properties

nameNode=hdfs://myserver:8020
jobTracker=myserver.com:8032
oozie.wf.application.path=hdfs://myserver/user/nathalok
oozie.use.system.libpath=true
oozie.libpath= hdfs://myserver/user/oozie/share/lib/lib_20150312161328/oozie
user.name=oozie

按顺序执行以下命令:

-bash-4.1$ oozie job -oozie http://myserver.com:11000/oozie -config job.properties -submit
job: 0000209-150501165011472-oozie-oozi-W

-bash-4.1$ oozie job -oozie http://myserver.com:11000/oozie -start 0000209-150501165011472-oozie-oozi-W

-bash-4.1$ oozie job -oozie http://myserver.com:11000/oozie -info 0000209-150501165011472-oozie-oozi-W
Job ID : 0000209-150501165011472-oozie-oozi-W
------------------------------------------------------------------------------------------------------------------------------------
Workflow Name : shell-wf
App Path      : hdfs://hdfspath/user/userid
Status        : RUNNING
Run           : 0
User          : userid
Group         : -
Created       : 2015-05-06 12:16 GMT
Started       : 2015-05-06 12:16 GMT
Last Modified : 2015-05-06 12:16 GMT
Ended         : -
CoordAction ID: -

Actions
------------------------------------------------------------------------------------------------------------------------------------
ID                                                                            Status    Ext ID                 Ext Status Err Code
------------------------------------------------------------------------------------------------------------------------------------
0000209-150501165011472-oozie-oozi-W@:start:                                  OK        -                      OK         -
------------------------------------------------------------------------------------------------------------------------------------
0000209-150501165011472-oozie-oozi-W@shell1                                   PREP      -                      -          -
------------------------------------------------------------------------------------------------------------------------------------

1 个答案:

答案 0 :(得分:0)

使用Oozie时,您不需要使用shell脚本来创建HDFS文件夹,而是使用Fs (HDFS) action中的构建 -

例如:

<action name="createFolder">
    <fs>
        <mkdir path="/my/folder" />
    </fs>
    <ok to="end"/>
    <error to="fail"/>
</action>