1. 程式人生 > 其它 >HDFS 提示 There are 6 missing blocks. The following files may be corrupted:

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 介面恢復正常