public interface LoadBalancer extends ConfigurationObserver
Cluster-wide load balancing will occur only when there are no regions in
transition and according to a fixed period of a time using balanceCluster(Map).
On cluster startup, bulk assignment can be used to determine locations for all Regions in a cluster.
This class produces plans for the
AssignmentManager
to execute.
| Modifier and Type | Field and Description |
|---|---|
static ServerName |
BOGUS_SERVER_NAME |
static java.lang.String |
SYSTEM_TABLES_ON_MASTER
Master carries system tables.
|
static java.lang.String |
TABLES_ON_MASTER
Master can carry regions as of hbase-2.0.0.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<RegionPlan> |
balanceCluster(java.util.Map<ServerName,java.util.List<RegionInfo>> clusterState)
Perform the major balance operation
|
java.util.List<RegionPlan> |
balanceCluster(TableName tableName,
java.util.Map<ServerName,java.util.List<RegionInfo>> clusterState)
Perform the major balance operation
|
void |
initialize()
Initialize the load balancer.
|
static boolean |
isSystemTablesOnlyOnMaster(Configuration conf) |
static boolean |
isTablesOnMaster(Configuration conf) |
void |
onConfigurationChange(Configuration conf)
This method would be called by the
ConfigurationManager
object when the Configuration object is reloaded from disk. |
void |
postMasterStartupInitialize()
If balancer needs to do initialization after Master has started up, lets do that here.
|
ServerName |
randomAssignment(RegionInfo regionInfo,
java.util.List<ServerName> servers)
Get a random region server from the list
|
void |
regionOffline(RegionInfo regionInfo)
Marks the region as offline at balancer.
|
void |
regionOnline(RegionInfo regionInfo,
ServerName sn)
Marks the region as online at balancer.
|
java.util.Map<ServerName,java.util.List<RegionInfo>> |
retainAssignment(java.util.Map<RegionInfo,ServerName> regions,
java.util.List<ServerName> servers)
Assign regions to the previously hosting region server
|
java.util.Map<ServerName,java.util.List<RegionInfo>> |
roundRobinAssignment(java.util.List<RegionInfo> regions,
java.util.List<ServerName> servers)
Perform a Round Robin assignment of regions.
|
void |
setClusterLoad(java.util.Map<TableName,java.util.Map<ServerName,java.util.List<RegionInfo>>> ClusterLoad)
Pass RegionStates and allow balancer to set the current cluster load.
|
void |
setClusterMetrics(ClusterMetrics st)
Set the current cluster status.
|
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
static final java.lang.String TABLES_ON_MASTER
static final java.lang.String SYSTEM_TABLES_ON_MASTER
static final ServerName BOGUS_SERVER_NAME
void setClusterMetrics(ClusterMetrics st)
st - void setClusterLoad(java.util.Map<TableName,java.util.Map<ServerName,java.util.List<RegionInfo>>> ClusterLoad)
ClusterLoad - void setMasterServices(MasterServices masterServices)
masterServices - java.util.List<RegionPlan> balanceCluster(TableName tableName, java.util.Map<ServerName,java.util.List<RegionInfo>> clusterState) throws HBaseIOException
tableName - clusterState - HBaseIOExceptionjava.util.List<RegionPlan> balanceCluster(java.util.Map<ServerName,java.util.List<RegionInfo>> clusterState) throws HBaseIOException
clusterState - HBaseIOExceptionjava.util.Map<ServerName,java.util.List<RegionInfo>> roundRobinAssignment(java.util.List<RegionInfo> regions,
java.util.List<ServerName> servers)
throws HBaseIOException
regions - servers - HBaseIOExceptionjava.util.Map<ServerName,java.util.List<RegionInfo>> retainAssignment(java.util.Map<RegionInfo,ServerName> regions,
java.util.List<ServerName> servers)
throws HBaseIOException
regions - servers - HBaseIOExceptionServerName randomAssignment(RegionInfo regionInfo,
java.util.List<ServerName> servers)
throws HBaseIOException
regionInfo - Region for which this selection is being done.servers - HBaseIOExceptionvoid initialize()
throws HBaseIOException
HBaseIOExceptionvoid regionOnline(RegionInfo regionInfo,
ServerName sn)
regionInfo - sn - void regionOffline(RegionInfo regionInfo)
regionInfo - void onConfigurationChange(Configuration conf)
ConfigurationObserverConfigurationManager
object when the Configuration object is reloaded from disk.onConfigurationChange in interface ConfigurationObservervoid postMasterStartupInitialize()
static boolean isTablesOnMaster(Configuration conf)
static boolean isSystemTablesOnlyOnMaster(Configuration conf)