问题一:/etc/cron.d下的定时任务执行一段时间后不执行
背景:在/etc/cron.d下加了一个定时任务,名为dispute_cron(使用root用户编辑),内容:
28 15 * * * hdfs /home/hdfs/xxx/work/disputefile/bin/rundispute.sh
使用hdfs用户每日定时执行该脚本rundispute.sh,执行一段时间后不执行了。
排查:1.看crond日志是否调起来,vim /var/log/cron 看日志在对应的时间点上相应的定时任务并没有被调起来。
2.切换到hdfs,执行crontab–e,报错:
鉴定令牌不再有效;需要新的鉴定令牌
You (hive) are not allowed to access to (crontab) because of pam configuration.
脚本是hdfs执行的,这表示hdfs密码过期了,执行chage–l hdfs,显示:
Last password change: Sep 25, 2016
Password expires: Dec 24, 2016 --过期时间
Password inactive: never
Account expires: never
Minimum number of days between password change: 0
Maximum number of days between password change: 90
Number of days of warning before password expires: 7
2016.12.24号之后该调度脚本就不能被hdfs用户调起了。
或vim /var/log/secure看密码过期提醒,若要过期会有提醒如:
***********************
3.设置用户密码永不过期,脚本即可被调用。
chage -M -1hdfs
参考文章:http://blog.itpub.net/29392174/viewspace-1063866/
http://www.th7.cn/system/lin/201602/153915.shtml
日志不全,还是改换成hdfs用户在crontab–e中加了下面内容:
28 15 * * * cd /home/hdfs/xxx/work/disputefile/bin; ./rundispute.sh >> ../logs/run.log 2>&1
可以进入cd /var/spool/cron/看每个用户配置的定时任务。
问题二:HIVE JDBC查询报错return code-101
java.sql.SQLException:Errorwhileprocessingstatement:FAILED:ExecutionError,returncode-101fromorg.apache.hadoop.hive.ql.exec.mr.MapRedTask.Java heap space.
……..
重启hiveserver2堆内存释放OK,不能解决根本问题:需要增加hivesever2堆内存或者优化查询,优化查询根据具体情况具体分析,可以调整hivesever2堆内存使其不溢出,如下(hortonworks平台):