今天巡检的时候发现很多Missing Block信息,大概有1千多个,基本上是error文件,我针对一个文件进行fsck,如下信息:

[root@nn ~]# hdfs fsck /kafka/kafka-sample/history/2014/errors-m-00003 -files -blocks -racks -locations
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Connecting to namenode via http://nn-resourcemanager.21:50070
FSCK started by root (auth:SIMPLE) from /192.168.2.101 for path /kafka/kafka-sample/history/2014/errors-m-00003 at Fri Aug 28 16:46:32 CST 2015
/kafka/kafka-sample/history/2014/errors-m-00003 166 bytes, 1 block(s):
/kafka/kafka-sample/history/2014/errors-m-00003: CORRUPT blockpool BP-1013849047-192.168.2.100-1413787589090 block blk_1073742241
 MISSING 1 blocks of total size 166 B
0. BP-1013849047-192.168.2.100-1413787589090:blk_1073742241_1417 len=166 MISSING!

Status: CORRUPT
 Total size:    166 B
 Total dirs:    0
 Total files:   1
 Total symlinks:                0
 Total blocks (validated):      1 (avg. block size 166 B)
  ********************************
  CORRUPT FILES:        1
  MISSING BLOCKS:       1
  MISSING SIZE:         166 B
  CORRUPT BLOCKS:       1
  ********************************
 Minimally replicated blocks:   0 (0.0 %)
 Over-replicated blocks:        0 (0.0 %)
 Under-replicated blocks:       0 (0.0 %)
 Mis-replicated blocks:         0 (0.0 %)
 Default replication factor:    2
 Average block replication:     0.0
 Corrupt blocks:                1
 Missing replicas:              0
 Number of data-nodes:          25
 Number of racks:               1
FSCK ended at Fri Aug 28 16:46:32 CST 2015 in 4 milliseconds


使用命令清楚这些Missing Block
hdfs dfs -delete
这个命令只是删除没有Block信息的文件,不会删除其他问题,可以放心使用。

删除后检查下
hdfs dfs /
12-18 07:06