hdfs fsck命令检查文件系统健康状态、处理missing blocks问题、hdfs fsck / -delete执行失败

前言

  hadoop集群由于磁盘损坏、节点挂机、机架掉电难免造成一些文件块损坏,通过hdfs fsck命令,检查HDFS上⽂件和⽬录的健康状态、获取⽂件的block信息和位置信息

如,出现报错There are 41 missing blocks. The following files may be corrupted

在这里插入图片描述


1. 命令详解

命令:

 hdfs fsck <path> [-list-corruptfileblocks | [-move | -delete | -openforwrite] [-files [-blocks [-locations | -racks]]]] [-includeSnapshots] [-storagepolicies] [-blockId <blk_Id>]

参数含义:

	<path>	检测的目录
	-move	把损坏的文件移动到/lost+found
	-delete	直接删除损坏的文件
	-files	打印被检测的文件
	-openforwrite	print out files opened for write
	-includeSnapshots	include snapshot data if the given path indicates a snapshottable directory or there are snapshottable directories under it
	-list-corruptfileblocks	print out list of missing blocks and files they belong to
	-blocks	打印 block 的信息
	-locations	打印 block 的位置,即在哪个节点
	-racks	print out network topology for data-node locations
	-storagepolicies	打印 block 存储的策略信息
	-blockId	打印指定blockId所属块的状况
	-replicaDetails	print out each replica details 

2. 使用

  首先执行hdfs fsck / -delete,发现执行hdfs fsck / -delete失败,查看hdfs状态
在这里插入图片描述

Safe mode is ON. Resources are low on NN. Please add or free up more resources then turn off safe mode manually. NOTE: If you turn off safe mode before adding resources, the NN will immediately return to safe mode. Use "hdfs dfsadmin -safemode leave" to turn safe mode off.

执行hdfs dfsadmin -safemode leave,再运行hdfs fsck / -delete
在这里插入图片描述
检查状态hdfs fsck /

在这里插入图片描述


  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

但行益事莫问前程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值