假设你的table有10个region,他们的名字分别为1,2...10
Hbase 并没有提供直接合并 2-8这7个region的方法,如果你要合并多个region,那要稍微麻烦一点,具体方法如下
首先使用Hbase shell自带的merge_region方法:
Merge two regions. Passing 'true' as the optional third parameter will force
a merge ('force' merges regardless else merge will fail unless passed
adjacent regions. 'force' is for expert use only).
NOTE: You must pass the encoded region name, not the full region name so
this command is a little different from other region operations. The encoded
region name is the hash suffix on region names: e.g. if the region name were
TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396. then
the encoded region name portion is 527db22f95c8a9e0116f0cc13c680396
Examples:
hbase> merge_region 'ENCODED_REGIONNAME', 'ENCODED_REGIONNAME'
hbase> merge_region 'ENCODED_REGIONNAME', 'ENCODED_REGIONNAME', true
使用merge_region方法合并多个region后会生成新的region,但是会有2个问题
1:overlap(hbase metadata信息没做处理)
2:hdfs上的region信息没做处理
解决这两个问题可以使用hbase hbck命令,举例:
hbase hbck ssp_rt -fixHdfsOverlaps -maxMerge 100 -fixMeta -fixAssignments
这个命令会合并hbase metadata中overlap的region并且删除hdfs上相应的文件
|
|