@InterfaceAudience.Private public class RegionSplitter extends Object
RegionSplitter
class provides several utilities to help in the
administration lifecycle for developers who choose to manually split regions
instead of having HBase handle that automatically. The most useful utilities
are:
Both operations can be safely done on a live server.
Question: How do I turn off automatic splitting?
Answer: Automatic splitting is determined by the configuration value
HConstants.HREGION_MAX_FILESIZE. It is not recommended that you set this
to Long.MAX_VALUE in case you forget about manual splits. A suggested setting
is 100GB, which would result in > 1hr major compactions if reached.
Question: Why did the original authors decide to manually split?
Answer: Specific workload characteristics of our use case allowed us
to benefit from a manual split system.
Question: Why is manual splitting good for this workload?
Answer: Although automated splitting is not a bad option, there are
benefits to manual splitting.
Question: What's the optimal number of pre-split regions to create?
Answer: Mileage will vary depending upon your application.
The short answer for our application is that we started with 10 pre-split regions / server and watched our data growth over time. It's better to err on the side of too little regions and rolling split later.
The more complicated answer is that this depends upon the largest storefile
in your region. With a growing data size, this will get larger over time. You
want the largest region to be just big enough that the
HStore
compact
selection algorithm only compacts it due to a timed major. If you don't, your
cluster can be prone to compaction storms as the algorithm decides to run
major compactions on a large series of regions all at once. Note that
compaction storms are due to the uniform data growth, not the manual split
decision.
If you pre-split your regions too thin, you can increase the major compaction interval by configuring HConstants.MAJOR_COMPACTION_PERIOD. If your data size grows too large, use this script to perform a network IO safe rolling split of all regions.
Modifier and Type | Class and Description |
---|---|
static class |
RegionSplitter.HexStringSplit
HexStringSplit is a well-known
RegionSplitter.SplitAlgorithm for choosing region
boundaries. |
static interface |
RegionSplitter.SplitAlgorithm
A generic interface for the RegionSplitter code to use for all it's
functionality.
|
static class |
RegionSplitter.UniformSplit
A SplitAlgorithm that divides the space of possible keys evenly.
|
Constructor and Description |
---|
RegionSplitter() |
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
The main function for the RegionSplitter application.
|
static RegionSplitter.SplitAlgorithm |
newSplitAlgoInstance(Configuration conf,
String splitClassName) |
public static void main(String[] args) throws IOException, InterruptedException, ParseException
args
- Usage: RegionSplitter <TABLE> <SPLITALGORITHM>
<-c <# regions> -f <family:family:...> | -r
[-o <# outstanding splits>]>
[-D <conf.param=value>]IOException
- HBase IO problemInterruptedException
- user requested exitParseException
- problem parsing user inputpublic static RegionSplitter.SplitAlgorithm newSplitAlgoInstance(Configuration conf, String splitClassName) throws IOException
IOException
- if the specified SplitAlgorithm class couldn't be
instantiated