我将使用在oozie工作流上运行的shell脚本将特定文件放入hdfs。运行shell脚本时出错,我的作业被终止

我将使用在oozie工作流上运行的shell脚本将特定文件放入hdfs。运行shell脚本时出错,我的作业被终止,shell,hadoop,hdfs,workflow,oozie,Shell,Hadoop,Hdfs,Workflow,Oozie,当我在包含shell脚本的oozie上运行工作流时,出现了错误。纱线应用程序日志显示错误: >>> Invoking Shell command line now >> Exit code of the Shell command 1 <<< Invocation of Shell command completed <<< 我有两个问题: 1-当我单独运行wget时。我在奥齐的工作结束了。但是我不知道test.txt在哪里?

当我在包含shell脚本的oozie上运行工作流时,出现了错误。纱线应用程序日志显示错误:

>>> Invoking Shell command line now >>

Exit code of the Shell command 1
<<< Invocation of Shell command completed <<<
我有两个问题: 1-当我单独运行
wget
时。我在奥齐的工作结束了。但是我不知道
test.txt
在哪里???(保存了哪个路径
test.txt
)。我尝试使用此命令为wget
ftp://ftpserver/test.txt -P/home/ambari qa
但当我在脚本中使用
/home/ambari qa
本地路径时,作业被终止。 2-当我单独使用
hdfs dfs-put
时,作业被终止。我不知道什么时候我在脚本中使用了
hdfs-dfs
命令,然后我的作业被终止了。 考虑到我的shell脚本在OZUI中使用时有问题,我必须改变它。请在我的shell脚本中建议正确的命令

oozie workflow.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<workflow-app xmlns="uri:oozie:workflow:0.5" name="test">
    <start to="shell_1"/>
    <action name="shell_1">
        <shell xmlns="uri:oozie:shell-action:0.3">
            <job-tracker>${resourceManager}</job-tracker>
            <name-node>${nameNode}</name-node>
            <exec>/user/ambari-qa/sample.sh</exec>
            <file>/user/ambari-qa/sample.sh</file>
        </shell>
        <ok to="end"/>
        <error to="kill"/>
    </action>
    <kill name="kill">
        <message>${wf:errorMessage(wf:lastErrorNode())}</message>
    </kill>
    <end name="end"/>
</workflow-app>

${resourceManager}
${nameNode}
/用户/ambari qa/sample.sh
/用户/ambari qa/sample.sh
${wf:errorMessage(wf:lastErrorNode())}

如果您的shell脚本无效,并且代码与0不同,则此错误不会提供信息。考虑到这一点,您应该首先检查可能导致问题的bash的正确EOL或其他行为,然后尝试使用oozie。

您的
告诉oozie下载
hdfs:///user/ambari-qa/sample.sh
到纱线容器的本地文件系统,无需重命名。因此,您应该简单地
sample.sh
看起来您真的需要一个关于Oozie基础知识的教程。试试“Hadoop上的钩子”13部分系列;有点老了,但仍然是最好的..我使用了
sample.sh
,但我的结果没有change@ahmad--您能够直接在hdfs上获取文件吗?@vikrant--shell脚本文件必须在hdfs上,并且在运行工作流后,文件必须在Thread容器中的datanode上下载,并在datanode上运行container
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<workflow-app xmlns="uri:oozie:workflow:0.5" name="test">
    <start to="shell_1"/>
    <action name="shell_1">
        <shell xmlns="uri:oozie:shell-action:0.3">
            <job-tracker>${resourceManager}</job-tracker>
            <name-node>${nameNode}</name-node>
            <exec>/user/ambari-qa/sample.sh</exec>
            <file>/user/ambari-qa/sample.sh</file>
        </shell>
        <ok to="end"/>
        <error to="kill"/>
    </action>
    <kill name="kill">
        <message>${wf:errorMessage(wf:lastErrorNode())}</message>
    </kill>
    <end name="end"/>
</workflow-app>