hbase因为数据空洞故障导致读写缓慢

栏目: 数据库 · 发布时间: 6年前

内容简介:腾讯云某客户的开发者反馈,大数据集群的hbase读写非常缓慢。我们使用测试程序,也复现该问题。因此,我们需要对hbase集群进行全面检测。在hbase用户下,使用以下命令:hbase hbck -details检查所有region 和 regionserver的情况,发现存储数据空洞现象:

一、故障现象

腾讯云某客户的开发者反馈,大数据集群的hbase读写非常缓慢。我们使用测试程序,也复现该问题。因此,我们需要对hbase集群进行全面检测。在hbase用户下,使用以下命令:

hbase hbck -details

检查所有region 和 regionserver的情况,发现存储数据空洞现象:

“ERROR: There is a hole in the region chain between …… You need to create a new .regioninfo and region dir in hdfs to plug the hole. ERROR: Found inconsistency in table TestTable”.

具体报错类似下面这样的:

ERROR: There is a hole in the region chain between TestTable,2,1415170922328.3c1b2a210888171d142059912e2faba1. and TestTable,3,1415171044919.da852e5b0034a2ca83f6966280454b4a. You need to create a new .regioninfo and region dir in hdfs to plug the hole.

ERROR: Found inconsistency in table TestTable

图1 数据空洞和异常日志

重启hbase,还发现以下错误:

图2 regionserver连接异常

二、常规处理办法

我们尝试使用 hbase hbck -fixAssignments 修复region数据,发现以下一些错误信息:

Region still in transition, waiting for it to become assigned error message

图3 执行修复命令后依然出现该问题
图4 region迁移信息错误

三、问题解决

通过查看社区类似情况,我们找到有用的信息。

总结起来就是有两种解决办法:

方法一:

具体链接如下所示:

https://viewsby.wordpress.com/2015/06/01/hbase-error-there-is-a-hole-in-the-region-chain/

https://serverfault.com/questions/510290/hbase-hbck-cant-fix-region-inconsistencies

To fix this issue you need to stop HBase and delete recover.edits folders for failing regions.

After that start HBase and run hbck which should succeed.

1 ) 停掉hbase集群

2)删除hbase在hdfs目录下所有表目录下的recovered.edits

3)重启hbase集群,所有的region就都online了

注意:这种通过删除recovered.edits的方式来恢复集群,会丢失部分数据。

方法二:

https://community.hortonworks.com/questions/8757/phoenix-local-indexes.html

https://blog.csdn.net/gxl0805/article/details/78211850

大致错误如下:

org.apache.hadoop.hbase.NotServingRegionException: Region ***** is not online on ip-10-5-4-24.ec2.internal,16020,1451996088952

This problem occurs when meta regions are not assigned yet and preScannerOpen coprocessor waits for reading meta table for local indexes, which results in openregionthreads to wait forever because of deadlock. you can solve this by increasing number of threads required to open the regions so that meta regions can be assigned even threads for local index table is still waiting to remove the deadlock.

解释:当元region 还没有分配时,preScannerOpen 协处理器会等待读取本地索引的元表,这会导致openregionthreads 因为死锁而永远等待。

解决办法就是提高regionserver的线程数量,以此来提高rs处理region的能力:

<property>

<name>hbase.regionserver.executor.openregion.threads</name>

<value>100</value>

</property>

因为可能存在数据丢失,因此我们没有使用方法一,而是使用的是方法二。

四、进一步优化hbase集群

与hbase regionserver相关的线程参数还有以下几个:

hbase.regionserver.executor.openregion.threads 默认3

hbase.regionserver.executor.openroot.threads 默认1

hbase.regionserver.executor.openmeta.threads 默认1

hbase.regionserver.executor.closeregion.threads 默认3

hbase.regionserver.executor.closeroot.threads 默认1

hbase.regionserver.executor.closemeta.threads 默认1

需要对这几个参数都进行优化。具体优化设定的值可以参考社区反馈。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C++沉思录

C++沉思录

Andrew Koenig、Barbara Moo / 黄晓春、孟岩(审校) / 人民邮电出版社 / 2008-1 / 55.00元

《C++沉思录》基于作者在知名技术杂志发表的技术文章、世界各地发表的演讲以及斯坦福大学的课程讲义整理、写作而成,融聚了作者10多年C++程序生涯的真知灼见。全书分为6篇32章,分别对C++语言的历史和特点、类和继承、STL与泛型编程、库的设计等几大技术话题进行了详细而深入的讨论,细微之处几乎涵盖了C++所有的设计思想和技术细节。全书通过精心挑选的实例,向读者传达先进的程序设计的方法和理念。一起来看看 《C++沉思录》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具