`

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();
  }

 

分享到:
评论
1 楼 qindongliang1922 2016-02-16  
楼主对hbase的掌握的不错啊, 

相关推荐

    hadoop+hbase+zookeeper集群配置流程及文件

    3. 初始化HBase:执行`hbase hbck -fix`检查和修复HBase元数据。 4. 启动HBase:通过`start-hbase.sh`命令启动Master和RegionServer。 Zookeeper3.4.12是一个分布式协调服务,用于管理Hadoop和HBase的元数据。配置...

    hbase,mysql备份压缩springboot代码

    1. **全量备份**:通过`hbase hbck`命令进行完整性检查并生成快照。另外,可以利用HDFS的`hadoop fs -get`命令将HBase的HDFS目录复制到安全的位置。 2. **增量备份**:HBase支持基于时间戳的快照功能,可以通过`...

    HBase运维实践-聊聊RIT的那点事

    在某些情况下,可能需要使用`hbase hbck`命令检查表的完整性,或者直接使用`hbase shell`中的`assign`、`unassign`或`offline`命令强制Region状态变迁。 了解RIT的工作机制和处理方法,对于HBase的运维至关重要。...

    hbase分布式搭建

    HBase 提供了多种工具,如 HBaseAdmin 用于管理表和 Region,HBaseShell 用于交互式操作,HFileViewer 查看 HFile 数据,以及 hbck 检查集群健康状况等。熟练掌握这些工具能提高日常运维效率。 总之,HBase 分布式...

    hbase运维手册

    hbck(HBase Check and Repair Tool)是一个强大的工具,用于修复损坏的HBase表或元数据。它可以检测并修复HBase表中的各种错误,如损坏的Region、丢失的数据文件等。hbck是HBase运维中不可或缺的一部分,尤其在遇到...

    10大HBase常见运维工具整理小结

    HBase,作为一款流行的NoSQL分布式数据库,因其复杂的设计和流程,对于缺乏大数据经验的运维人员来说,管理起来具有一定的挑战。为了帮助开发人员和运维人员更好地管理和维护HBase集群,这里我们将深入探讨十大常见...

Global site tag (gtag.js) - Google Analytics