我试图编写一个仅包含hadoop流作业的简单 map ,该作业从hdfs读取数据并将其推送到vertica。
我写了如下的shell脚本
./vsql -c "copy $TABLE from stdin delimiter E'\t' direct null '\\N';" -U $DBUSER -w $DBPWD -h $DBHOST -p $DBPORT
我创建了oozie工作流程为:
<action name="loadToVertica">
<map-reduce>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}/user/$USER/output/${exportDataDate}"/>
</prepare>
<streaming>
<mapper>shell export.sh</mapper>
</streaming>
<configuration>
<property>
<name>oozie.libpath</name>
<value>${wfsBasePath}/libs</value>
</property>
<property>
<name>mapred.input.dir</name>
<value>${nameNode}/user/$USER$/{exportDataDate}</value>
</property>
<property>
<name>mapred.output.dir</name>
<value>${nameNode}/user/$USER/output/${exportDataDate}</value>
</property>
<property>
<name>mapred.reduce.tasks</name>
<value>0</value>
</property>
</configuration>
<file>${wfsBasePath}/libs/${STREAMING_JAR_PATH}#${STREAMING_JAR_PATH}</file>
<file>${wfsBasePath}/libs/oozie-sharelib-streaming-4.2.0.2.5.3.0-37.jar#oozie-sharelib-streaming-4.2.0.2.5.3.0-37.jar</file>
<file>${wfsBasePath}/scripts/export.sh#export.sh</file>
<file>${wfsBasePath}/config/vsql#vsql</file>
</map-reduce>
<ok to="end"/>
<error to="end"/>
</action>
当我运行此程序时,作业的状态为“失败/杀死”,而没有任何错误消息。
最佳答案
在#!/ bin / sh之后添加-e可以帮助我追踪实际的错误。
在脚本中添加-e选项后,日志中将显示错误代码。
之后,第一行看起来像:
#!/bin/sh -e
关于hadoop - Hadoop Streaming Job在OOzie中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44491776/