如何增加 HBase 中的区域数量 table

How to increase number of regions in an HBase table

我在 HBase 中创建了一个 table 预拆分 8 个区域,使用 HexStringSplit 作为拆分算法。现在我想增加区域的数量,而不破坏现有的 table 和其中的数据。我创建预拆分的命令是

create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}

事实上,我无法再次执行此命令以增加区域数量。是否存在更新现有 table 中区域数量的命令?

请注意,您提供的命令创建了 15 个区域,而不是 8 个:create 't1', 'f1', {NUMREGIONS => 15, SPLITALGO => 'HexStringSplit'}

您可以使用拆分命令拆分区域:

hbase(main):001:0> split

Here is some help for this command:
Split entire table or pass a region to split individual region.  With the
second parameter, you can specify an explicit split key for the region.
Examples:
    split 'tableName'
    split 'regionName' # format: 'tableName,startKey,id'
    split 'tableName', 'splitKey'
    split 'regionName', 'splitKey'

你应该使用split 'regionName', 'splitKey'split 'tableName', 'splitKey',只是不要忘记为每个区域提供适当的SplitKey(中间那个)以确保均匀分布。您可以在 http://your-hbase-master:60010/table.jsp?name=your-table

查看当前区域

即:如果您有一个 StartKey 为 20000000 和 EndKey 为 40000000 的区域,您的 splitKey 将为 30000000,或者,如果您有一个具有 StartKey 20000000 和 EndKey 30000000 的区域,您的 SplitKey 将为 28000000(请记住,它是十六进制)

请先尝试使用测试表,直到您对这个过程有足够的信心。