hbase hbck流程

 

HBaseFsck类的hbase hbck流程;hbck是一个很重的管理工具,他会访问所有rs,扫描整个meta表,以及读取所有table region里的regioninfo,所以不要频繁使用hbck,会给hbase带来压力

 

 /**
   * This repair method requires the cluster to be online since it contacts
   * region servers and the masters.  It makes each region's state in HDFS, in
   * hbase:meta, and deployments consistent.
   *
   * @return If > 0 , number of errors detected, if < 0 there was an unrecoverable
   * error.  If 0, we have a clean hbase.
   */
  public int onlineConsistencyRepair() throws IOException, KeeperException,
    InterruptedException {
    clearState();

    // get regions according to what is online on each RegionServer
    //加载每个regionserver上的region,将regioninfo放入map中,regioninfo中没有metainfo
    loadDeployedRegions();
    // check whether hbase:meta is deployed and online
    //加载meta表的regioninfo,并检查meta表的regioninfo
    recordMetaRegion();
    // Check if hbase:meta is found only once and in the right place
    //检查meta表,有且只有一个region
    if (!checkMetaRegion()) {
      String errorMsg = "hbase:meta table is not consistent. ";
      if (shouldFixAssignments()) {
        errorMsg += "HBCK will try fixing it. Rerun once hbase:meta is back to consistent state.";
      } else {
        errorMsg += "Run HBCK with proper fix options to fix hbase:meta inconsistency.";
      }
      errors.reportError(errorMsg + " Exiting...");
      return -2;
    }
    // Not going with further consistency check for tables when hbase:meta itself is not consistent.
    LOG.info("Loading regionsinfo from the hbase:meta table");
    //扫描meta表,将regioninfo放入map中,添加metainfo信息
    boolean success = loadMetaEntries();
    if (!success) return -1;

    // Empty cells in hbase:meta?
    reportEmptyMetaCells();

    // Check if we have to cleanup empty REGIONINFO_QUALIFIER rows from hbase:meta
    if (shouldFixEmptyMetaCells()) {
      fixEmptyMetaCells();
    }

    // get a list of all tables that have not changed recently.
    if (!checkMetaOnly) {
      reportTablesInFlux();
    }

    // load regiondirs and regioninfos from HDFS
    if (shouldCheckHdfs()) {//唯一一个默认是true的
      loadHdfsRegionDirs();//获得所有hbase table region dir,将regioninfo hbckinfo上添加hdfsentry对象,表示region在hdfs上的信息
      loadHdfsRegionInfos();//获得所有hbase table region hfile,检查region是否存在(meta region存在,hdfs region不存在)
    }

    // Get disabled tables from ZooKeeper
    loadDisabledTables();

    // fix the orphan tables
    fixOrphanTables();

    // Check and fix consistency
    checkAndFixConsistency();//默认流程,检查meta和hdfs上的region丢失

    // Check integrity (does not fix)
    checkIntegrity();//默认流程,检查region漏洞
    return errors.getErrorList().size();
  }

 

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值