HDFS 提示 There are 6 missing blocks. The following files may be corrupted:

问题描述

不知怎得最近在启动测试环境的时候 hdfs 总是进入安全模式,无奈手动离开此模式才能进行正常操作

[hui@hadoop201 ~]$ hdfs dfsadmin -safemode get
Safe mode is ON
[hui@hadoop201 ~]$ hdfs dfsadmin -safemode leave
Safe mode is OFF

今天无意间登录了 hdfs web 页面发现了有一个警告信息,才发现 hdfs丢了一点文件

There are 6 missing blocks. The following files may be corrupted:


blk_1073743362    /tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop202_44572
blk_1073743363    /tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop201_34618
blk_1073743364    /tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop203_38826
blk_1073743598    /tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop202_40701
blk_1073743599    /tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop201_34111
blk_1073744218    /tmp/logs/hui/logs-tfile/application_1646310503374_0004/hadoop203_35289
Please check the logs or run fsck in order to identify the missing blocks. See the Hadoop FAQ for common causes and potential solutions.

解决方案

1、查看丢失文件情况

[hui@hadoop201 job]$ hdfs fsck /
Connecting to namenode via http://hadoop201:9870/fsck?ugi=hui&path=%2F
FSCK started by hui (auth:SIMPLE) from /192.168.124.141 for path / at Sun Mar 06 00:42:11 CST 2022

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop201_34618: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743363

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop201_34618: CORRUPT 1 blocks of total size 410409 B.
/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop202_44572: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743362

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop202_44572: CORRUPT 1 blocks of total size 251360 B.
/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop203_38826: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743364

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop203_38826: CORRUPT 1 blocks of total size 332373 B.
/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop201_34111: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743599

/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop201_34111: CORRUPT 1 blocks of total size 1072914 B.
/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop202_40701: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743598

/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop202_40701: CORRUPT 1 blocks of total size 90956 B.
/tmp/logs/hui/logs-tfile/application_1646310503374_0004/hadoop203_35289: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073744218

/tmp/logs/hui/logs-tfile/application_1646310503374_0004/hadoop203_35289: CORRUPT 1 blocks of total size 111347 B.

2、删除丢失文件的数据

[hui@hadoop201 job]$ hdfs fsck -delete
Connecting to namenode via http://hadoop201:9870/fsck?ugi=hui&delete=1&path=%2F
FSCK started by hui (auth:SIMPLE) from /192.168.124.141 for path / at Sun Mar 06 00:53:45 CST 2022

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop201_34618: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743363

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop201_34618: CORRUPT 1 blocks of total size 410409 B.
/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop202_44572: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743362

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop202_44572: CORRUPT 1 blocks of total size 251360 B.
/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop203_38826: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743364

/tmp/logs/hui/logs-tfile/application_1644582136486_0001/hadoop203_38826: CORRUPT 1 blocks of total size 332373 B.
/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop201_34111: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743599

/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop201_34111: CORRUPT 1 blocks of total size 1072914 B.
/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop202_40701: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073743598

/tmp/logs/hui/logs-tfile/application_1644832307762_0002/hadoop202_40701: CORRUPT 1 blocks of total size 90956 B.
/tmp/logs/hui/logs-tfile/application_1646310503374_0004/hadoop203_35289: CORRUPT blockpool BP-284743301-192.168.124.141-1642979744475 block blk_1073744218

/tmp/logs/hui/logs-tfile/application_1646310503374_0004/hadoop203_35289: CORRUPT 1 blocks of total size 111347 B.
Status: CORRUPT
 Number of data-nodes:  3

刷新 hdfs web 界面恢复正常

 

posted @ 2022-03-05 16:56  晓枫的春天  阅读(748)  评论(0编辑  收藏  举报