HBCK2修复hbase2的常见场景

上一文章已经把HBCK2 怎么在小于hbase2.0.3版本的编译与用法介绍了,解决主要场景

查看hbase存在的问题

一、使用hbase hbck命令

hbase hbck命令是对hbase的元数据进行检查,看是否有不健康的region

image

问题1:Unable to read .tableinfo

使用 参数 generateMissingTableDescriptorFile
hbase org.apache.hbase.HBCK2 generateMissingTableDescriptorFile hbase:meta

问题2:region is not onlie 导致该表无法查询

hbase后台报错: xxx region is not onlie
hbase hbck检测错误:
ERROR: Region { meta => kylin_metadata,,1626761168323.1d8cb3ce4a074d6a706c9fee570129df., hdfs => hdfs://master:8020/apps/hbase/data/data/default/kylin_metadata/1d8cb3ce4a074d6a706c9fee570129df, deployed => , replicaId => 0 } not deployed on any region server.

解决方式:

  1. 看到Regionname是:1d8cb3ce4a074d6a706c9fee570129df
  2. 执行命令重新分配 Region
  3. hbase org.apache.hbase.HBCK2 -d -s assigns 1d8cb3ce4a074d6a706c9fee570129df
  4. 如果有多个Region,直接写代码使用正则表达式[a-zA-Z0-9]{32}获取所有错误信息里面的RegionName
    hbase org.apache.hbase.HBCK2 -d -s assigns RegionName1 RegionName2 RegionName3

问题3:hbase:namespace的regionoffline 导致master is initializing

解决方式:

  1. 查询 hbase:meta表 hbase:namespace的region scan 'hbase:meta'

image

2.找到regionname
3. hbase org.apache.hbase.HBCK2 -d -s assigns regionname
4.desc 任意一个表,看是否能查询

问题3 region is closing ,region被lock

  1. 先去hbase ui的
    image

左边就是pid,看到wating状态的pid 需要执行bypass
2.执行
hbase org.apache.hbase.HBCK2 -d -s bypass -o -r 22887 22889 22888
对会返回true的标志的pid 所对应的 regionname 执行下面命令
3.hbase org.apache.hbase.HBCK2 -d -s unassigns regionname1,regionname2

原文地址:https://www.cnblogs.com/hejunhong/p/15074060.html