前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >hbase因为数据空洞故障导致读写缓慢

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

原创
作者头像
mikealzhou
修改2018-10-29 11:10:37
7K1
修改2018-10-29 11:10:37
举报
文章被收录于专栏:大数据平台TBDS大数据平台TBDS

一、故障现象

腾讯云某客户的开发者反馈,大数据集群的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  数据空洞和异常日志
图1 数据空洞和异常日志

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

图2  regionserver连接异常
图2 regionserver连接异常

二、常规处理办法

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

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

图3 执行修复命令后依然出现该问题
图3 执行修复命令后依然出现该问题
图4  region迁移信息错误
图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

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

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
大数据
全栈大数据产品,面向海量数据场景,帮助您 “智理无数,心中有数”!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档