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

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

内容简介:腾讯云某客户的开发者反馈,大数据集群的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

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


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

查看所有标签

猜你喜欢:

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

JUnit Recipes中文版

JUnit Recipes中文版

陈浩等译 / 电子工业 / 2006-9 / 69.00元

《JUnit Recipes中文版:程序员实用测试技巧》主要介绍了在Java开发中使用JUnit进行单元测试的各种方法、原则、技巧与实践。本书出自开发一线专家之手,本着实用的原则,涵盖各类Java开发中应用JUnit的实用技巧,内容丰富、全面深入;无论对于需要应用JUnit进行单元测试的一线Java开发人员,还是JUnit入门、进阶者,本书都是一本不可多得的实用指南。这本书介绍了大量的JUnit实......一起来看看 《JUnit Recipes中文版》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

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

在线XML、JSON转换工具