我正在尝试通过Oozie运行一个sh
脚本,但是我遇到了问题:
无法在目录“/mapred/local/taskTracker/dell/jobcache/job_201312061003_0001/attempt_201312061003_0001_m_000000_0/work”中运行程序“script.sh”: java.io.IOException: error=2, 没有那个文件或目录。
请帮我提供必要的步骤。
我正在尝试通过Oozie运行一个sh
脚本,但是我遇到了问题:
无法在目录“/mapred/local/taskTracker/dell/jobcache/job_201312061003_0001/attempt_201312061003_0001_m_000000_0/work”中运行程序“script.sh”: java.io.IOException: error=2, 没有那个文件或目录。
请帮我提供必要的步骤。
这个错误信息非常模糊。以下是一些问题,这些问题帮助我解决了此问题。
-如果您在kerberized集群上运行oozie工作流,请确保通过传递您的Kerberos Keytab进行身份验证:
...
<shell>
<exec>scriptPath.sh</exec>
<file>scriptPath.sh</file>
<file>yourKeytabFilePath</file>
</shell>
...
-在您的shell文件(scriptPath.sh)中,请确保删除第一行的shell引用。
#!usr/bin/bash
实际上,如果这个 shell reference 没有在所有的数据节点上部署,就会导致出现这个错误代码。
<exec>/user/nathalok/run.sh</exec>
<file>/user/nathalok/run.sh#run.sh</file>
并确保在job.properties中正确提及库和workflow.xml
的路径。
oozie.libpath=hdfs://server/user/oozie/share/lib/lib_20150312161328/oozie
oozie.wf.application.path=hdfs://bcarddev/user/budaledi/Teradata_Flow
workflow.xml :
...
<shell>
<exec>script.sh</exec>
<file>scripts/script.sh</file>
</shell>
...
请确保在hdfs的同一文件夹中拥有scripts/script.sh脚本。
一个Oozie shell操作在随机的Hadoop节点上执行,即不是在运行Oozie服务器的机器本地执行。正如Oleksii所说,您必须确保脚本在执行作业的节点上。
请参见以下完整示例,执行shell操作和ssh操作:
https://github.com/airawat/OozieSamples/tree/master/oozieProject/workflowShellAction https://github.com/airawat/OozieSamples/tree/master/oozieProject/workflowSshAction
set ff=unix
。 - Sivaprasanna Sethuraman同时确保shell脚本符合UNIX标准。如果这些shell脚本是在Windows环境下编写的,则会附加Windows特定的行尾(EOL),并且这些脚本不会被oozie识别。因此,在oozie shell操作中,您将收到“找不到文件或目录”的错误提示。
workflow.xml 的内容大致如下
<workflow-app name="HiveQuery_execution" xmlns="uri:oozie:workflow:0.5">
<start to="shell-3c43"/>
<kill name="Kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<action name="shell-3c43">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>/user/path/hivequery.sh</exec>
<file>/user/path/hivequery.sh#hivequery.sh</file>
<capture-output/>
</shell>
<ok to="End"/>
<error to="Kill"/>
</action>
<end name="End"/>
Job.properties
jobTracker=xxxx.xxx.xxx.com:port
nameNode=hdfs://xxxx.xxx.xxx.com:port
建议通过UI进行更好的配置,如上所述
ls -la
以证明它在那里。你是手动复制还是使用oozie通过<file>script.sh</file>复制的? - Oleksii