我目前正在创建一个工作流程,它将自动通过sqoop导入数据。我要做的是验证通过此过程导入的行数(记录)是否准确; sqoop提供的validate参数在此处不起作用,因为sqoop作业不是导入单个表。
我创建了一个名为“validation”的动作,它将调用并执行一个名为validation的shell脚本。此验证脚本执行以下步骤:
但是,当我运行它时,我收到以下错误,它没有向我提供我需要的信息:
2014-09-22 19:03:59,156 INFO ShellActionExecutor:539 - USER[v523043] GROUP[-] TOKEN[-] APP[voipImportToHDFS] JOB[0000359-140905180027053-oozie-oozi-W] ACTION[0000359-140905180027053-oozie-oozi-W@validation] action completed, external ID [null]
2014-09-22 19:03:59,159 WARN ShellActionExecutor:542 - USER[v523043] GROUP[-] TOKEN[-] APP[voipImportToHDFS] JOB[0000359-140905180027053-oozie-oozi-W] ACTION[0000359-140905180027053-oozie-oozi-W@validation] Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]
2014-09-22 19:03:59,177 INFO ActionEndXCommand:539 - USER[v523043] GROUP[-] TOKEN[-] APP[voipImportToHDFS] JOB[0000359-140905180027053-oozie-oozi-W] ACTION[0000359-140905180027053-oozie-oozi-W@validation] end executor for wf action 0000359-140905180027053-oozie-oozi-W with wf job 0000359-140905180027053-oozie-oozi-W
2014-09-22 19:03:59,198 INFO ActionEndXCommand:539 - USER[v523043] GROUP[-] TOKEN[-] APP[voipImportToHDFS] JOB[0000359-140905180027053-oozie-oozi-W] ACTION[0000359-140905180027053-oozie-oozi-W@validation] ERROR is considered as FAILED for SLA
我的验证脚本使用命令:
hadoop fs -cat ...
我在这里忽略了兼容性问题吗?我需要以不同的方式配置吗?
我的验证脚本(进行中版本):
for table in ${tables[*]}
do
#Get the number of records from DB Exadata
verifiedCount=$(sqoop eval --connect $3 --query "SELECT COUNT(*) FROM $4.${tables[table]} WHERE INTRVL_DT = To_Date('$5')" | awk '/([0-9]+)/{print $2}')
#echo "Total Number of Records " $verifiedCount
#Count the number of rows imported
totalRows=0
for ((i=0;i<$mapJobs;i++)) {
count[$i]=$(hadoop fs -cat $6$7/${tables[table]}/$8/$9/$10/part-m-0000$i | wc -l)
totalRows=$((totalRows + ${count[$i]}))
#if value has 0 lines, remove the file from edgenode to limit overhead
if [ ${count[$i]} -eq "0" ]
then
hadoop fs -rmr $6$7/${tables[table]}/$8/$9/$10/part-m-0000$i
echo "Removing..."
fi
}
#echo values
if [ "$totalRows" -eq "$verifiedCount" ]
then
echo "evaluation=true"
evaluation=true
else
echo "evaluation=false"
evaluation=false
exit 40
fi
done
答案 0 :(得分:0)
暴力错误调试导致我找到错误,包括以下行:
hadoop fs -rmr $6$7/${tables[table]}/$8/$9/$10/part-m-0000$i
具体来说,-rmr与环境不匹配,导致它崩溃。