under replicated blocks 解决办法

本文介绍如何使用hadoop fs的setrep命令解决Ambari监控页面上显示的underreplicated blocks警告。通过调整dfs.replication参数,并运行setrep命令设置文件的备份份数,最终消除监控警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ambari 监控页面显示under replicated blocks 显示红色。查了一下发现可以用hadoop fs 的 setrep命令解决这个问题。

下面是运行 hadoop fs -help 时,对这个命令的解释

-setrep [-R] [-w] <rep> <path> ... :
  Set the replication level of a file. If <path> is a directory then the command
  recursively changes the replication factor of all files under the directory tree
  rooted at <path>.

  -w  It requests that the command waits for the replication to complete. This   
      can potentially take a very long time.                                     
  -R  It is accepted for backwards compatibility. It has no effect.

因为我们的测试集群只有两个结点datanode ,所以需要先把dfs.replication 修改成2, 默认是3。
因为我们集群从搭建好都没改过这个配置,所以所有的文件都是需要备份3份,但实际只能复制2份,所有对所有文件都要进行这个操作。
然后执行下面命令,监控页面的监控就没有警告了

hadoop  fs -setrep -R -w 2 /

如果只是某些文件出这个问题,可以指定路径:

hadoop dfs -setrep -w 3 /path/to/file

https://community.hortonworks.com/questions/18819/how-to-fix-missing-and-under-replicated-blocks.html

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值