You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/03/09 22:35:36 UTC

[GitHub] [hbase-operator-tools] joshelser commented on a change in pull request #46: HBASE-23562 [operator tools] Add a RegionsMerge tool that allows for …

joshelser commented on a change in pull request #46: HBASE-23562 [operator tools] Add a RegionsMerge tool that allows for …
URL: https://github.com/apache/hbase-operator-tools/pull/46#discussion_r389960883
 
 

 ##########
 File path: hbase-tools/README.md
 ##########
 @@ -0,0 +1,87 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+# Apache HBase Tool for merging regions
+
+_RegionsMerger_ is an utility tool for manually merging bunch of regions of
+a given table. It's mainly useful on situations when an HBase cluster has too
+many regions per RegionServers, and many of these regions are small enough that
+it can be merged together, reducing the total number of regions in the cluster
+and releasing RegionServers overall memory resources.
+
+This may happen for mistakenly pre-splits, or after a purge in table
+data, as regions would not be automatically merged.
+
+## Setup
+Make sure HBase tools jar is added to HBase classpath:
+
+```
+export HBASE_CLASSPATH=$HBASE_CLASSPATH:./hbase-tools-1.1.0-SNAPSHOT.jar
+```
+
+## Usage
+
+_RegionsMerger_ requires two arguments as parameters: 1) The name of the table
+to have regions merged; 2) The desired total number of regions for the informed
+table. For example, to merge all regions of table `my-table` until it gets to a
+total of 5 regions, assuming the _setup_ step above has been performed:
+
+```
+$ hbase org.apache.hbase.RegionsMerger my-table 5
+```
+
+## Implementation Details
+
+_RegionsMerger_ uses client API
+_org.apache.hadoop.hbase.client.Admin.getRegions_ to fetch the list of regions
+for the specified table, iterates through the resulting list, identifying pairs
+of adjacent regions. For each pair found, it submits a merge request using
+_org.apache.hadoop.hbase.client.Admin.mergeRegionsAsync_ client API method.
+This means multiple merge requests had been sent once the whole list has been
+iterated.
+
+Assuming all these requests complete, resulting total number of
+regions will be ceil((original total number regions)/2). This resulting total
 
 Review comment:
   nit: use english instead of pseudocode for a README.
   
   > Assuming that all merges issued by the RegionsMerger are successful, the resulting number of regions will be no more than half the original number of regions.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services