使用 oozie 执行 shell-script 时出错

Error while executing shell-script using oozie

我正在尝试 运行 kafka-connect-hdfs 使用 Oozie version: 4.2.0.2.6.5.0-292 通过脚本文件 sample.sh.
是的,我知道我们可以直接 运行 kafka-hdfs 连接器,但它应该通过 oozie 实现。
Kafka 有一个主题sample,里面有一些数据。
尝试通过 oozie 将该数据推送到 hdfs。
我来这里之前参考了很多资源,但现在运气好。

错误

Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]
2018-07-25 09:54:16,945  INFO ActionEndXCommand:520 - SERVER[nnuat.iot.com] USER[root] GROUP[-] TOKEN[] APP[sample] JOB[0000000-180725094930282-oozie-oozi-W] ACTION[0000000-180725094930282-oozie-oozi-W@shell1] ERROR is considered as FAILED for SLA

我在 hdfs 中拥有所有三个文件,并授予了所有文件 (sample.sh, job.properties, workflow.xml) 的权限,所有文件都在 hdfs 中的 /user/root/sample 位置。

注意:运行集群中的oozie因此所有三个节点都具有与namenode(/root/oozie-demo)和confluent-kafka(/opt/confluent-4.. 1.1) 也是。

job.properties

nameNode=hdfs://171.18.1.192:8020
jobTracker=171.18.1.192:8050
queueName=default
oozie.libpath=${nameNode}/user/oozie/share/lib/lib_20180703063118
oozie.wf.rerun.failnodes=true
oozie.use.system.libpath=true
oozieProjectRoot=${nameNode}/user/${user.name}
oozie.wf.application.path=${nameNode}/user/${user.name}/sample

workflow.xml

<workflow-app xmlns="uri:oozie:workflow:0.3" name="sample">
<start to="shell1"/>
<action name="shell1">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
             <property>
                   <name>hadoop.proxyuser.oozie.hosts</name>
                  <value>*</value>
             </property>
             <property>
                   <name>hadoop.proxyuser.oozie.groups</name>
                   <value>*</value>
            </property>
            <property>
                    <name>oozie.launcher.mapreduce.map.java.opts</name>
                   <value>-verbose</value>
            </property>
        </configuration>
    <!--<exec>${myscript}</exec>-->
        <exec>smaple.sh</exec>
         <env-var>HADOOP_USER_NAME=${wf:user()}</env-var>
        <file>hdfs://171.18.1.192:8020/user/root/sample/smaple.sh</file>
         <capture-output/>
    </shell>
    <ok to="end"/>
    <error to="fail"/>
</action>
<kill name="fail">
<message>Shell action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<kill name="fail-output">
    <message>Incorrect output, expected [Hello Oozie] but was [${wf:actionData('shellaction')['my_output']}]</message>
</kill>
<end name="end"/>
</workflow-app>

sample.sh #!/bin/bash

 sudo /opt/confluent-4.1.1/bin/connect-standalone /opt/confluent-4.1.1/etc/schema-registry/connect-avro-standalone.properties /opt/confluent-4.1.1/etc/kafka-connect-hdfs/IOT_DEMO-hdfs.properties

我找不到错误的原因,我也试过将 confluent-kafka 中的所有 jar 文件放到 hdfs 的 oozie/lib 目录中。

link 用于 yarn 和 oozie 错误日志。yarn-oozie-error-logs

谢谢!

Kafka Connect 完全是 运行 独立进程,不通过 Oozie 调度。

它永远不会死,除非出现错误并且如果 Oozie 重新启动失败的任务,您几乎可以保证运行在 HDFS 上获取重复数据,因为连接偏移不会永久存储在任何地方,除了本地磁盘(假设 Connect 在另一台机器上重新启动)所以我不明白这一点。

您应该独立 运行 connect-distributed.sh 作为一组专用机器上的系统服务,然后您 POST 配置 JSON 连接 HTTP 端点.然后,任务将作为 Connect 框架的一部分进行分发,并将偏移量持久存储回 Kafka 主题以进行故障处理 运行ce


如果你绝对想使用 Oozie,Confluent 包含 Camus 工具,该工具已被弃用,支持 Connect,但我一直在维护 Camus + Oozie 过程一段时间,它工作得很好,它只是一旦添加了很多主题,就很难监控失败。 Apache Gobbilin 是该项目的第二次迭代,不由 Confluent

维护

您似乎也是 运行 HDP,因此 Apache Nifi 也应该能够安装在您的集群上,以处理 Kafka 和 HDFS 相关任务