Oozie - Hadoop commands are not executing (Shell)

巧了我就是萌 提交于 2020-01-04 05:30:55

问题


I am running a shell script that has hadoop commands.

Getting the following error when executing the same

Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]

I am running a simple shell script with Cloudera Hue - Oozie

However when the script has no hadoop commands, it gets executed sucessfully.

I have set oozie.use.system.libpath=true and could see my libs are in

user/oozie/share/lib/<lib_timestmap>

Below is the shell script I am trying to run

#! /bin/bash
$(hadoop fs -mkdir /<location path>)

Wokflow.xml

<workflow-app name="Shell-copy" xmlns="uri:oozie:workflow:0.4">
    <start to="Shell-copy"/>
    <action name="Shell-copy">
        <shell xmlns="uri:oozie:shell-action:0.1">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <exec>test.sh</exec>
            <file>/user/hue/oozie/workspaces/_rrv9kor_-oozie-38-1455857816.12/test.sh#test.sh</file>
              <capture-output/>
        </shell>
        <ok to="end"/>
        <error to="kill"/>
    </action>
    <kill name="kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>
  • The scripts with hadoop commands either throwing the above error or displayed as completed successfully with none of the hadoop commands processed and only the echo's or other shell commands are executed.

回答1:


The problem with the shell action is that shell jobs are deployed as the 'mapred' user. As the above is deploying the oozie job from a user account other than mapred user , Permission Denied error was thrown.The way to solve this is to set the HADOOP_USER_NAME environment variable to the user account name through which you deploy your oozie workflow.

<env-var>HADOOP_USER_NAME=user_name_goes_here</env-var>


来源:https://stackoverflow.com/questions/35570890/oozie-hadoop-commands-are-not-executing-shell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!