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. Sql Server根据表名生成查询的存储过程(查询条件可选)

    static void Main(string[] args) { string 表名 = "water_emstime"; string sql = "exec Get ...

  2. (转)java中Executor、ExecutorService、ThreadPoolExecutor介绍

    转自: http://blog.csdn.net/linghu_java/article/details/17123057 ScheduledThreadPoolExecutor介绍: http:// ...

  3. Dynamics CRM 系统自己定义部分的语言翻译

    Dynamics CRM 自带语言切换功能,在官网下载所需语言包安装后,在设置语言中就能看到你所加入的语言.勾选要启用的语言应用就可以.再打开系统设置--语言就能看到可更改用户界面语言的显示了. wa ...

  4. iOS-常用宏定义

    下面我为大家提供一些常用的宏定义! 将这些宏定义 加入到.pch使用 再也不用 用一次写一次这么长的程序了 //-------------------获取设备大小------------------- ...

  5. java动态编译 (java在线执行代码后端实现原理)

    需求:要实现一个web网页中输入java代码,然后能知道编译结果以及执行结果 类似于菜鸟java在线工具的效果:https://c.runoob.com/compile/10 刚开始从什么概念都没有到 ...

  6. 170117、spring解决乱码

    spring解决乱码这个问题网上有很多解决方法,也可以关注本博客的文章,在此不再赘述, 今天推荐大家另外两种解决方法! 问题现象: 1.后台代码 2.前端界面 解决方法: 方法1:是在后台请求方法上加 ...

  7. Centos6.5下Samba服务器的安装和配置

    1.安装samba服务 # yum install samba samba-client samba-swat 2.安装包说明 samba-3.6.23-43.el6_9.x86_64----> ...

  8. delphi -----(去掉窗口最大化,最小化、关闭),主窗口,和子窗口之间的设置

    一.去掉窗口最大化,最小化.关闭 borderIcons:biSystemMenu:false borderStyle:bsSizeable 二.主子窗口 主main: //调用子窗体procedur ...

  9. Sum---poj1844(数学题)

    题目链接:http://poj.org/problem?id=1844 题意:给一个整数n,求当n由1到k的连续整数加或减组成时的最小的k. 如果n全部由加法组成,那么k可以组成k(k+1)/2,设减 ...

  10. 基于Requests和BeautifulSoup实现“自动登录”

    基于Requests和BeautifulSoup实现“自动登录”实例 自动登录抽屉新热榜 #!/usr/bin/env python # -*- coding:utf-8 -*- import req ...