1.前言
Hadoop集群进行机器缩容时发现HDFS集群出现大量的Under Replicated Blocks并且请求同步副本数为10超过默认设置的副本数2(dfs.replication),影响集群稳定性。
2.分析
【1】查看NameNode的UI页面出现大量的Under Replicated Blocks且长时间没有完成image.png
image.png
hdfs dfs -setrep -w 2 /user/root/.staging/job_1724120681289_0001/job.split
【4】在hive-site.xml中增加下列配置项,值设置为2,集群恢复正常。
<property>
<name>mapreduce.client.submit.file.replication</name>
<value>10</value>
<description>The replication level for submitted job files. This
should be around the square root of the number of nodes.
</description>
</property>
3.总结
出现上述问题主要原因是MapReduce的mapreduce.client.submit.file.replication默认为10,当集群规模恰好低于10台时才会出现上述现象。因为只在Hive中运行MapReduce任务,所以在hive-site.xml中增加此配置项并且值设置为2即可,不需要重启服务。