@InterfaceAudience.Private public interface LoadBalancer extends org.apache.hadoop.conf.Configurable, Stoppable, 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 String |
SYSTEM_TABLES_ON_MASTER
Master carries system tables.
|
static String |
TABLES_ON_MASTER
Master can carry regions as of hbase-2.0.0.
|
Modifier and Type | Method and Description |
---|---|
List<RegionPlan> |
balanceCluster(Map<ServerName,List<RegionInfo>> clusterState)
Perform the major balance operation
|
List<RegionPlan> |
balanceCluster(TableName tableName,
Map<ServerName,List<RegionInfo>> clusterState)
Perform the major balance operation
|
void |
initialize()
Initialize the load balancer.
|
static boolean |
isMasterCanHostUserRegions(org.apache.hadoop.conf.Configuration conf) |
static boolean |
isSystemTablesOnlyOnMaster(org.apache.hadoop.conf.Configuration conf) |
static boolean |
isTablesOnMaster(org.apache.hadoop.conf.Configuration conf) |
void |
onConfigurationChange(org.apache.hadoop.conf.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,
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.
|
Map<ServerName,List<RegionInfo>> |
retainAssignment(Map<RegionInfo,ServerName> regions,
List<ServerName> servers)
Assign regions to the previously hosting region server
|
Map<ServerName,List<RegionInfo>> |
roundRobinAssignment(List<RegionInfo> regions,
List<ServerName> servers)
Perform a Round Robin assignment of regions.
|
void |
setClusterLoad(Map<TableName,Map<ServerName,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.
|
void |
updateBalancerStatus(boolean status) |
static final String TABLES_ON_MASTER
static final String SYSTEM_TABLES_ON_MASTER
static final ServerName BOGUS_SERVER_NAME
void setClusterMetrics(ClusterMetrics st)
st
- void setClusterLoad(Map<TableName,Map<ServerName,List<RegionInfo>>> ClusterLoad)
ClusterLoad
- void setMasterServices(MasterServices masterServices)
masterServices
- List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName,List<RegionInfo>> clusterState) throws HBaseIOException
tableName
- clusterState
- HBaseIOException
List<RegionPlan> balanceCluster(Map<ServerName,List<RegionInfo>> clusterState) throws HBaseIOException
clusterState
- HBaseIOException
Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) throws HBaseIOException
regions
- servers
- HBaseIOException
@Nullable Map<ServerName,List<RegionInfo>> retainAssignment(Map<RegionInfo,ServerName> regions, List<ServerName> servers) throws HBaseIOException
regions
- servers
- HBaseIOException
ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers) throws HBaseIOException
regionInfo
- Region for which this selection is being done.servers
- HBaseIOException
void initialize() throws HBaseIOException
HBaseIOException
void regionOnline(RegionInfo regionInfo, ServerName sn)
regionInfo
- sn
- void regionOffline(RegionInfo regionInfo)
regionInfo
- void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserver
ConfigurationManager
object when the Configuration
object is reloaded from disk.onConfigurationChange
in interface ConfigurationObserver
void postMasterStartupInitialize()
void updateBalancerStatus(boolean status)
static boolean isTablesOnMaster(org.apache.hadoop.conf.Configuration conf)
static boolean isSystemTablesOnlyOnMaster(org.apache.hadoop.conf.Configuration conf)
static boolean isMasterCanHostUserRegions(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2019 Cloudera. All rights reserved.