简体   繁体   English

无法通过oozie运行shell脚本

[英]Can't run shell script via oozie

I'm trying to run a shell script that just create a directory via mkdir command via oozie workflow. 我正在尝试运行仅通过oozie工作流程通过mkdir命令创建目录的Shell脚本。

I'm using HDP 2.6.5 | 我正在使用HDP 2.6.5 | Oozie 4.2.0 Oozie 4.2.0

The error message is always : 错误消息始终为:

java.io.IOException: Cannot run program "test.sh" (in directory "/hadoop/yarn/local/usercache/whorchani/appcache/application_1547225966242_3390/container_e111_1547225966242_3390_01_000002"): error=2, No such file or directory java.io.IOException:无法运行程序“ test.sh”(在目录“ / hadoop / yarn / local / usercache / whorchani / appcache / application_1547225966242_3390 / container_e111_1547225966242_3390_01_000002”中):错误= 2,没有此类文件或目录

It's hard to answer your question if you don't at least post your Oozie XML for the relevant action. 如果您至少没有发布有关相关操作的Oozie XML,将很难回答您的问题。 My guess is that you haven't used the <file> tag. 我的猜测是您没有使用<file>标记。

From Apache Oozie by Mohammad Kamrul Islam and Aravind Srinivasan 来自Mohammad Kamrul Islam和Aravind Srinivasan的Apache Oozie

Because the shell command runs on any Hadoop node, you need to be aware of the path of the binary on these nodes. 由于shell命令可在任何Hadoop节点上运行,因此您需要了解二进制文件在这些节点上的路径。 The executable has to be either available on the node or copied by the action via the distributed cache using the <file> tag. 可执行文件必须在节点上可用,或者由操作使用<file>标记通过分布式缓存复制。 For the binaries on the node that are not copied via the cache, it's perhaps safer and easier to debug if you always use an absolute path. 对于未通过缓存复制的节点上的二进制文件,如果始终使用绝对路径,则可能更安全,更容易调试。

Here is a simple example of a shell action: 这是一个shell操作的简单示例:

    <action name="shell_action">
        <shell xmlns = "uri:oozie:shell-action:0.1">
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <exec>sh</exec>
            <argument>my_shell_script.sh</argument>
            <file>/full/hdfs/path/to/your/script/my_shell_script.sh</file>
        </shell>
        <ok to="action2"/>
        <error to="fail"/>
    </action>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM