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



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

>>> Invoking Shell command line now >>
Exit code of the Shell command 1
<<< Invocation of Shell command completed <<<

我将从ftp服务器下载文件,使用oozie工作流将文件放入hdfs路径。我用shell脚本定义工作流在shell脚本中,我使用wget下载文件,然后使用hdfs dfs -put命令将文件从本地加载到hdfs

当在主节点上运行shell脚本时,它可以正常工作。这是shell脚本:(sample.sh(

wget ftp://ftpserver/test.txt
hdfs dfs -put test.txt hdfs://master1:8020/user/ambari-qa

我有两个问题:1-当我单独运行wget时。我在奥齐的工作成功地完成了。但我不知道test.txt在哪里???(哪个路径保存了test.txt(。我尝试用这个命令为wgetftp://ftpserver/test.txt -P /home/ambari-qa定义路径,但当我在脚本中使用/home/ambari-qa本地路径时,作业被终止。2-当我单独使用hdfs dfs -put时,作业被杀死。我不知道当我在脚本中使用hdfs dfs命令时,我的工作就会被终止。当我在oozie中使用shell脚本时,请考虑我的shell脚本有问题,我必须更改它。请在我的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>

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

最新更新