
经过分析,由实时计算pisces服务spark streamming 任务日志导致hdfs空间暴增。

.inprogress 结尾的为未完成任务
hdfs dfs -ls /user/spark/applicationHistory/ | grep application_ | grep -v '.inprogress$'|awk '{print $8}'
hdfs dfs -rm -f $(hdfs dfs -ls /user/spark/applicationHistory/ | grep application_ | grep -v '.inprogress$'|awk '{print $8}')
默认删除入hdfs回收站,所以需要清理/user/hdfs/.Trash/* 内容,才是释放空间。

crontab -u hdfs -e
0 2 * * * sh hdfs dfs -rm -f $(hdfs dfs -ls /user/spark/applicationHistory/ | grep application_ |awk '{print $8}') && hdfs dfs -rm -r -f /user/hdfs/.Trash/*
此时空间已被正常清理,等待一会hdfs集群服务恢复正常。


网友评论