@InterfaceAudience.Private public class RSGroupBasedLoadBalancer extends Object implements RSGroupableBalancer, LoadBalancer
| Modifier and Type | Field and Description |
|---|---|
static String |
HBASE_GROUP_LOADBALANCER_CLASS
Config for pluggable load balancers
|
BOGUS_SERVER_NAME| Constructor and Description |
|---|
RSGroupBasedLoadBalancer() |
RSGroupBasedLoadBalancer(RSGroupInfoManager RSGroupInfoManager) |
| 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
|
Configuration |
getConf() |
Map<HRegionInfo,ServerName> |
immediateAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
Sync assign a region
|
void |
initialize()
Initialize the load balancer.
|
boolean |
isOnline() |
boolean |
isStopped() |
void |
onConfigurationChange(Configuration conf)
This method would be called by the
ConfigurationManager
object when the Configuration object is reloaded from disk. |
ServerName |
randomAssignment(HRegionInfo region,
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 |
setConf(Configuration conf) |
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
void |
stop(String why)
Stop this service.
|
public static final String HBASE_GROUP_LOADBALANCER_CLASS
@InterfaceAudience.Private public RSGroupBasedLoadBalancer()
@InterfaceAudience.Private public RSGroupBasedLoadBalancer(RSGroupInfoManager RSGroupInfoManager)
public Configuration getConf()
public void setConf(Configuration conf)
public void setClusterStatus(ClusterStatus st)
LoadBalancersetClusterStatus in interface LoadBalancerpublic void setMasterServices(MasterServices masterServices)
LoadBalancersetMasterServices in interface LoadBalancerpublic List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName,List<HRegionInfo>> clusterState) throws HBaseIOException
LoadBalancerbalanceCluster in interface LoadBalancerHBaseIOExceptionpublic List<RegionPlan> balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState) throws HBaseIOException
LoadBalancerbalanceCluster in interface LoadBalancerHBaseIOExceptionpublic Map<ServerName,List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions, List<ServerName> servers) throws HBaseIOException
LoadBalancerroundRobinAssignment in interface LoadBalancerHBaseIOExceptionpublic Map<ServerName,List<HRegionInfo>> retainAssignment(Map<HRegionInfo,ServerName> regions, List<ServerName> servers) throws HBaseIOException
LoadBalancerretainAssignment in interface LoadBalancerHBaseIOExceptionpublic ServerName randomAssignment(HRegionInfo region, List<ServerName> servers) throws HBaseIOException
LoadBalancerrandomAssignment in interface LoadBalancerregion - Region for which this selection is being done.HBaseIOExceptionpublic Map<HRegionInfo,ServerName> immediateAssignment(List<HRegionInfo> regions, List<ServerName> servers) throws HBaseIOException
LoadBalancerimmediateAssignment in interface LoadBalancerHBaseIOExceptionpublic void initialize()
throws HBaseIOException
LoadBalancerinitialize in interface LoadBalancerHBaseIOExceptionpublic boolean isOnline()
public void regionOnline(HRegionInfo regionInfo, ServerName sn)
LoadBalancerregionOnline in interface LoadBalancerpublic void regionOffline(HRegionInfo regionInfo)
LoadBalancerregionOffline in interface LoadBalancerpublic void onConfigurationChange(Configuration conf)
ConfigurationObserverConfigurationManager
object when the Configuration object is reloaded from disk.onConfigurationChange in interface ConfigurationObserveronConfigurationChange in interface LoadBalancerpublic boolean isStopped()
isStopped in interface StoppableStoppable.stop(String) has been closed.