切换到hdfs用户,执行:
su - hdfs
hdfs fsck / | grep 'Under replicated' | awk -F':' '{print $1}' >> /tmp/under_replicated_files
新建脚本repair.sh并执行:
cd /tmp && touch repair.sh && chmod u+x repair.sh
脚本内容如下:
for hdfsfile in `cat /tmp/under_replicated_files`;do
echo "Fixing $hdfsfile :" ;
hadoop fs -setrep 3 $hdfsfile;
done
网友评论