HBASE-12701 Document how to set the split policy on a given table
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/9283b93e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9283b93e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9283b93e Branch: refs/heads/hbase-11339 Commit: 9283b93e225edfaddbb8b24dd1b8214bcd328e97 Parents: 200ec5b Author: Misty Stanley-Jones <[email protected]> Authored: Tue Feb 10 14:05:00 2015 +1000 Committer: Misty Stanley-Jones <[email protected]> Committed: Tue Feb 10 14:05:41 2015 +1000 ---------------------------------------------------------------------- src/main/asciidoc/_chapters/architecture.adoc | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/9283b93e/src/main/asciidoc/_chapters/architecture.adoc ---------------------------------------------------------------------- diff --git a/src/main/asciidoc/_chapters/architecture.adoc b/src/main/asciidoc/_chapters/architecture.adoc index cd9a4a9..1833cfc 100644 --- a/src/main/asciidoc/_chapters/architecture.adoc +++ b/src/main/asciidoc/_chapters/architecture.adoc @@ -1331,6 +1331,35 @@ The RegionServer splits a region, offlines the split region and then adds the da See <<disable.splitting>> for how to manually manage splits (and for why you might do this). ==== Custom Split Policies +ou can override the default split policy using a custom link:http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.html[RegionSplitPolicy](HBase 0.94+). Typically a custom split policy should extend +HBase's default split policy: link:http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/regionserver/IncreasingToUpperBoundRegionSplitPolicy.html[IncreasingToUpperBoundRegionSplitPolicy]. + +The policy can set globally through the HBase configuration or on a per-table +basis. + +.Configuring the Split Policy Globally in _hbase-site.xml_ +[source,xml] +---- +<property> + <name>hbase.regionserver.region.split.policy</name> + <value>org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy</value> +</property> +---- + +.Configuring a Split Policy On a Table Using the Java API +[source,java] +HTableDescriptor tableDesc = new HTableDescriptor("test"); +tableDesc.setValue(HTableDescriptor.SPLIT_POLICY, ConstantSizeRegionSplitPolicy.class.getName()); +tableDesc.addFamily(new HColumnDescriptor(Bytes.toBytes("cf1"))); +admin.createTable(tableDesc); +---- + +[source] +.Configuring the Split Policy On a Table Using HBase Shell +---- +hbase> create 'test', {METHOD => 'table_att', CONFIG => {'SPLIT_POLICY' => 'org.apache.hadoop.hbase.regionserver.ConstantSizeRegionSplitPolicy'}}, +{NAME => 'cf1'} +---- The default split policy can be overwritten using a custom link:http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/regionserver/RegionSplitPolicy.html[RegionSplitPolicy(HBase 0.94+)]. Typically a custom split policy should extend HBase's default split policy: link:http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/regionserver/ConstantSizeRegionSplitPolicy.html[ConstantSizeRegionSplitPolicy].
