我正在尝试编写一个简单的 Map ,只有hadoop流式传输作业从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>
当我运行它时,作业状态为Failed / Killed,没有任何错误消息 .
1 回答
在#!/ bin / sh之后添加-e帮助我跟踪实际错误是什么 .
在脚本中添加-e选项后,日志中出现了错误代码 .
在此之后,第一行看起来像: