Hbase提供了hbck命令来检查各种不一致问题。hbck的名字仿效了HDFS的fsck命令,后者是一个用于检查HDFS中不一致问题的工具。下面这段非常易懂的介绍出自于hbck的源程序。

检查数据在Master及RegionServer的内存中状态与数据在HDFS中的状态之间的一致性。

HBase的hbck不仅能够检查不一致问题,而且还能够修复不一致问题。

在生产环境中,应当经常运行hbck,以便及早发现不一致问题并更容易地解决问题。

一、问题

首先,在HBase上创建一张表usertable。

然后,在HDFS上直接删除usertable表的目录/hbase/usertable来删除表的数据(错误的做法)。

二、解决方法

1.hbase hbck

Status:OK,表示没有发现不一致问题。

Status:INCONSISTENT,表示有不一致问题。

2.hbase hbck -fixAssignments

Try to fix region assignments.  Replaces the old -fix

[zk: 192.168.147.15:2181(CONNECTED) 3] ls /hbase/unassigned

3.hbase hbck -fixMeta

Try to fix meta problems.  This assumes HDFS region info is good.

hbase(main):007:0>  scan '.META.'

4.hbase(main):015:0> create 'usertable','f1'

ERROR: Table already exists: usertable!

[zk: 192.168.147.15:2181(CONNECTED) 4] ls /hbase/table

[usertable]

[zk: 192.168.147.15:2181(CONNECTED) 5] get /hbase/table/usertable

ENABLING

[zk: 192.168.147.15:2181(CONNECTED) 6] rmr /hbase/table/usertable

[zk: 192.168.147.15:2181(CONNECTED) 7] get /hbase/table/usertable

Node does not exist: /hbase/table/usertable

此时,create 'usertable','f1',依然提示同样的错误。

查看ZKTable源码:

  1. /**
  2. * Cache of what we found in zookeeper so we don't have to go to zk ensemble
  3. * for every query.  Synchronize access rather than use concurrent Map because
  4. * synchronization needs to span query of zk.
  5. */
  6. private final Map<String, TableState> cache =
  7. new HashMap<String, TableState>();
  8. this.cache.put(tableName, state);

把ZK中的数据缓存在本地内存中,以加速访问,减少访问时间。

为了让本地内存中的数据失效,必须重启HBase集群。

重启HBase集群。

此时,create 'usertable','f1',没有提示错误,表创建成功。

三、hbck

  1. [bigdata@tbe192168147015 ~]$ hbase hbck -h
  2. Usage: fsck [opts] {only tables}
  3. where [opts] are:
  4. -help Display help options (this)
  5. -details Display full report of all regions.
  6. -timelag {timeInSeconds}  Process only regions that  have not experienced any metadata updates in the last  {{timeInSeconds} seconds.
  7. -sleepBeforeRerun {timeInSeconds} Sleep this many seconds before checking if the fix worked if run with -fix
  8. -summary Print only summary of the tables and status.
  9. -metaonly Only check the state of ROOT and META tables.
  10. Repair options: (expert features, use with caution!)
  11. -fix              Try to fix region assignments.  This is for backwards compatiblity
  12. -fixAssignments   Try to fix region assignments.  Replaces the old -fix
  13. -fixMeta          Try to fix meta problems.  This assumes HDFS region info is good.
  14. -fixHdfsHoles     Try to fix region holes in hdfs.
  15. -fixHdfsOrphans   Try to fix region dirs with no .regioninfo file in hdfs
  16. -fixHdfsOverlaps  Try to fix region overlaps in hdfs.
  17. -fixVersionFile   Try to fix missing hbase.version file in hdfs.
  18. -maxMerge <n>     When fixing region overlaps, allow at most <n> regions to merge. (n=5 by default)
  19. -sidelineBigOverlaps  When fixing region overlaps, allow to sideline big overlaps
  20. -maxOverlapsToSideline <n>  When fixing region overlaps, allow at most <n> regions to sideline per group. (n=2 by default)
  21. -repair           Shortcut for -fixAssignments -fixMeta -fixHdfsHoles -fixHdfsOrphans -fixHdfsOverlaps -fixVersionFile -sidelineBigOverlaps
  22. -repairHoles      Shortcut for -fixAssignments -fixMeta -fixHdfsHoles -fixHdfsOrphans

[转]HBase hbck——检察HBase集群的一致性的更多相关文章

  1. HBase HA的分布式集群部署(适合3、5节点)

    本博文的主要内容有: .HBase的分布模式(3.5节点)安装    .HBase的分布模式(3.5节点)的启动 .HBase HA的分布式集群的安装 .HBase HA的分布式集群的启动    .H ...

  2. HBase的多节点集群详细启动步骤(3或5节点)(分为Zookeeper自带还是外装)

    HBase的多节点集群详细启动步骤(3或5节点)分为: 1.HBASE_MANAGES_ZK的默认值是false(zookeeper外装)(推荐) 2.HBASE_MANAGES_ZK的默认值是tru ...

  3. HBase 2.1.3 集群 web 报错InvalidProtocolBufferException 解决方法

    搭建好HBase 集群后,各种后台进程都正常,搭建手册参考: Hbase 2.1.3 集群搭建手册https://www.cndba.cn/dave/article/3322 但是通过web访问,却报 ...

  4. HBase+Phoenix整合入门--集群搭建

    环境:CentOS 6.6 64位    hbase 1.1.15  phoenix-4.7.0-HBase-1.1 一.前置环境: 已经安装配置好Hadoop 2.6和jdk 1.7 二.安装hba ...

  5. hbase 0.98.1集群安装

    本文将基于hbase 0.98.1解说其在linux集群上的安装方法,并对一些重要的设置项进行解释,本文原文链接:http://blog.csdn.net/bluishglc/article/deta ...

  6. YCSB测试HBase远程完全分布式集群

    写在前面 本文只讲一个很简单的问题,YCSB对HBase集群的测试.虽然网上有很多介绍YCSB测试HBase的文章,但都是针对本地HBase伪分布式集群的.大家都知道,稍微正式一些的压测都会要求测试客 ...

  7. HBase体系架构和集群安装

    大家好,今天分享的是HBase体系架构和HBase集群安装.承接上两篇文章<HBase简介>和<HBase数据模型>,点击回顾这2篇文章,有助于更好地理解本文. 一.HBase ...

  8. HBase混布MapReduce集群学习记录

    一.准备工作 1.1 部署环境 集群规模大概260多台,TSC10机型,机型参数如下: > 1个8核CPU(E5-2620v4) > 64G内存 > HBA,12*4T SATA,1 ...

  9. HBase的单节点集群详细启动步骤(分为Zookeeper自带还是外装)

    伪分布模式下,如(weekend110)hbase-env.sh配置文档中的HBASE_MANAGES_ZK的默认值是true,它表示HBase使用自身自带的Zookeeper实例.但是,该实例只能为 ...

随机推荐

  1. 利用JQuery jsonp实现Ajax跨域请求 .Net 的*.handler 和 WebService,返回json数据

    1:跨域请求handler一般处理程序 using System; using System.Collections.Generic; using System.Web; using System.W ...

  2. linux用户与组管理命令的基本操作

    用户账号管理命令 为了提高系统的利用率,避免因多个用户共用一个root账号而造成不必要要的系统安全隐患,通常需要为 新用户添加账户.在Linux系统中,添加用户只能由超级用户来完成,也就是说,只能由r ...

  3. android手机常用分辨率

      QVGA(240x320)    HVGA(320x480)     WVGA(800x480)     FWVGA(854x480)     qHD(960x540)     DVGA(960x ...

  4. Oracle数据库设计第三范式

    一.数据库设计范式及其意义和不足 数据库的设计范式是数据库设计所需要满足的规范,数据库的规范化是优化表的结构和优化把数据组织到表中的方式,这样使数据更明确,更简洁.实践中,通常把一个数据库分成两个或多 ...

  5. 巨蟒python全栈开发-第22天 内置常用模块1

    一.今日主要内容 1.简单了解模块 你写的每一个py文件都是一个模块 数据结构(队列,栈(重点)) 还有一些我们一直在使用的模块 buildins 内置模块.print,input random 主要 ...

  6. Virtual Private Cloud 专有网络 软件定义网络的方式 私有网络 大流量视频、直播类业务

    私有网络 VPC_云上网络空间_自定义网络 - 腾讯云 https://cloud.tencent.com/product/vpc 私有网络 VPC 简介 私有网络(Virtual Private C ...

  7. MyISAM Key Buffer 读/写/利用率(%) MylSAM平均每秒Key Buffer利用率(%) MylSAM平均每秒Key Buffer读命中率(%) MylSAM平均每秒Key Buffer写命中率(%)

    MyISAM Key Buffer 读/写/利用率(%) MylSAM平均每秒Key Buffer利用率(%)MylSAM平均每秒Key Buffer读命中率(%)MylSAM平均每秒Key Buff ...

  8. Storm-源码分析-acker (backtype.storm.daemon.acker)

    backtype.storm.daemon.acker 设计的巧妙在于, 不用分别记录和track, stream过程中所有的tuple, 而只需要track root tuple, 而所有中间过程都 ...

  9. Vue(5)- axios、vuex

    一.内容回顾 1.webpack(前端中工作,项目上线之前对整个前端项目优化) - entry:整个项目的程序入口(main.js或index.js): - output:输出的出口: - loade ...

  10. 升级系统到ubuntun到18.04后apt-get执行失败

    系统升级到18.04后执行apt-get install的时候报错 root@zhf-maple:/home/zhf/桌面# apt-get install vim-sciptsE: 无法获得锁 /v ...