@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)
.
Inline region placement with immediateAssignment(java.util.List<org.apache.hadoop.hbase.HRegionInfo>, java.util.List<org.apache.hadoop.hbase.ServerName>)
can be used when
the Master needs to handle closed regions that it currently does not have
a destination set for. This can happen during master failover.
On cluster startup, bulk assignment can be used to determine locations for all Regions in a cluster.
This classes produces plans for the AssignmentManager
to execute.
Modifier and Type | Field and Description |
---|---|
static ServerName |
BOGUS_SERVER_NAME |
Modifier and Type | Method and Description |
---|---|
List<RegionPlan> |
balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState)
Perform the major balance operation
|
List<RegionPlan> |
balanceCluster(TableName tableName,
Map<ServerName,List<HRegionInfo>> clusterState)
Perform the major balance operation
|
Map<HRegionInfo,ServerName> |
immediateAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
Sync assign a region
|
void |
initialize()
Initialize the load balancer.
|
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(HRegionInfo regionInfo,
List<ServerName> servers)
Get a random region server from the list
|
void |
regionOffline(HRegionInfo regionInfo)
Marks the region as offline at balancer.
|
void |
regionOnline(HRegionInfo regionInfo,
ServerName sn)
Marks the region as online at balancer.
|
Map<ServerName,List<HRegionInfo>> |
retainAssignment(Map<HRegionInfo,ServerName> regions,
List<ServerName> servers)
Assign regions to the previously hosting region server
|
Map<ServerName,List<HRegionInfo>> |
roundRobinAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
Perform a Round Robin assignment of regions.
|
void |
setClusterStatus(ClusterStatus st)
Set the current cluster status.
|
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
void |
updateBalancerStatus(boolean status) |
static final ServerName BOGUS_SERVER_NAME
void setClusterStatus(ClusterStatus st)
st
- void setMasterServices(MasterServices masterServices)
masterServices
- List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName,List<HRegionInfo>> clusterState) throws HBaseIOException
tableName
- clusterState
- HBaseIOException
List<RegionPlan> balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState) throws HBaseIOException
clusterState
- HBaseIOException
Map<ServerName,List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions, List<ServerName> servers) throws HBaseIOException
regions
- servers
- HBaseIOException
Map<ServerName,List<HRegionInfo>> retainAssignment(Map<HRegionInfo,ServerName> regions, List<ServerName> servers) throws HBaseIOException
regions
- servers
- HBaseIOException
Map<HRegionInfo,ServerName> immediateAssignment(List<HRegionInfo> regions, List<ServerName> servers) throws HBaseIOException
regions
- servers
- HBaseIOException
ServerName randomAssignment(HRegionInfo regionInfo, List<ServerName> servers) throws HBaseIOException
regionInfo
- Region for which this selection is being done.servers
- HBaseIOException
void initialize() throws HBaseIOException
HBaseIOException
void regionOnline(HRegionInfo regionInfo, ServerName sn)
regionInfo
- sn
- void regionOffline(HRegionInfo 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)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.