天天看點

HBase識别和移動損壞的HFile (hfile corrupted)(-checkCorruptHFiles)

HBase-識别和移動損壞的HFile

    • 識别損壞的檔案:
    • 對損壞的檔案進行旁注:

識别損壞的檔案:

HBase提供了一個實用程式來檢查HBase中是否有損壞的檔案。

hbase hbck -checkCorruptHFiles

上面的指令将檢查整個HBase表中是否有損壞的檔案。

要檢查特定表中的損壞,請使用以下指令:

hbase hbck -checkCorruptHFiles <表名稱>

如果任何檔案已損壞,那麼輸出日志中将顯示以下内容:

Checked 17 hfile for corruption
  HFiles corrupted:                  2
    HFiles moved while checking:     0
Summary: CORRUPTED
           

日志還包含有關哪些檔案已損壞的詳細資訊。

檢查檔案是否已損壞的另一種方法是使用以下指令:

hbase org.apache.hadoop.hbase.io.hfile.HFile -f <路徑到hfile>

對損壞的檔案進行旁注:

hbase hbck -sidelineCorruptHFiles
           

指令将檢查整個HBase表。

要應用于特定表,請使用以下指令:

hbase hbck -sidelineCorruptHFiles <表名稱>

您将在指令輸出日志中看到類似的資訊:

Checked 17 hfile for corruption
  HFiles corrupted:                  2
    HFiles successfully quarantined: 2
      maprfs:/hbase/corrupt/hcrt/1090c602c005a4ca76fda4ec7bd2865c/f/97fcf7fee25c469a81e7a0aa567a4627
      maprfs:/hbase/corrupt/hcrt/1090c602c005a4ca76fda4ec7bd2865c/f/97fcf7fee25c469a81e7a0aa567a4628
    HFiles failed quarantine:        0
    HFiles moved while checking:     0
Summary: CORRUPTED => OK


The corrupted files are moved to '/hbase/corrupt' folder.