一. Orphan修复风险
我们了解了hbck对orphan修复原理后,知道orphan是根据hdfs的Hfile修复的regioninfo文件(如果没有Hfile,则直接将该region进行sideline),再删除该region.
HBCK这种修复存在的风险,是由于region变迁导致:
(1)如果region的数据hfile数据为空,但是内存存在数据,突然master宕机,此时,由于原先的region被迁移走了,重启master会导致数据丢失。
(2)对于region的变化,对功能的影响,需要根据实际应用评估。
二.异常定位
什么样的异常属于Orphan?
ERROR: Orphan region in HDFS: Unable to load .regioninfo from table testorphan1 in hdfs
dir hdfs://hadoop01:9000/hbase/data/default/testorphan1/4be88dea6a76bf0b91d2557465b664ac! It may be an invalid format or version file. Treating as an orphaned regiondir.
java.io.FileNotFoundException: File does not exist:
/hbase/data/default/testorphan1/4be88dea6a76bf0b91d2557465b664ac/.regioninfo
ERROR: There is a hole in the region chain between 100 and 200. You need to create a new
.regioninfo and region dir in hdfs to plug the hole.
ERROR: Found inconsistency in table testorphan1
三.orphan的异常修复
如果出现第二节的异常, 怎样修复能确保不丢失数据?
可以按照如下步骤修复:
1. flush region/table
2.hbck -fixHdfsOrphans table
3. hbase hbck -fixHdfsHoles table
4.hbase hbck -fixMeta
5.hbase hbck -fixAssignment
————————————————
版权声明:本文为CSDN博主「shfshihuafeng」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/shfshihuafeng/article/details/90734562