@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
|
HBASE_RSGROUP_LOADBALANCER_CLASS
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
|
org.apache.hadoop.conf.Configuration |
getConf() |
Set<HRegionInfo> |
getMisplacedRegions(Map<HRegionInfo,ServerName> regions) |
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(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 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(org.apache.hadoop.conf.Configuration conf) |
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
void |
stop(String why)
Stop this service.
|
void |
updateBalancerStatus(boolean status) |
public static final String HBASE_GROUP_LOADBALANCER_CLASS
@InterfaceAudience.Private public RSGroupBasedLoadBalancer()
@InterfaceAudience.Private public RSGroupBasedLoadBalancer(RSGroupInfoManager RSGroupInfoManager)
public org.apache.hadoop.conf.Configuration getConf()
getConf
in interface org.apache.hadoop.conf.Configurable
public void setConf(org.apache.hadoop.conf.Configuration conf)
setConf
in interface org.apache.hadoop.conf.Configurable
public void setClusterStatus(ClusterStatus st)
LoadBalancer
setClusterStatus
in interface LoadBalancer
public void setMasterServices(MasterServices masterServices)
LoadBalancer
setMasterServices
in interface LoadBalancer
public List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName,List<HRegionInfo>> clusterState) throws HBaseIOException
LoadBalancer
balanceCluster
in interface LoadBalancer
HBaseIOException
public List<RegionPlan> balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState) throws HBaseIOException
LoadBalancer
balanceCluster
in interface LoadBalancer
HBaseIOException
public Map<ServerName,List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions, List<ServerName> servers) throws HBaseIOException
LoadBalancer
roundRobinAssignment
in interface LoadBalancer
HBaseIOException
public Map<ServerName,List<HRegionInfo>> retainAssignment(Map<HRegionInfo,ServerName> regions, List<ServerName> servers) throws HBaseIOException
LoadBalancer
retainAssignment
in interface LoadBalancer
HBaseIOException
public Map<HRegionInfo,ServerName> immediateAssignment(List<HRegionInfo> regions, List<ServerName> servers) throws HBaseIOException
LoadBalancer
immediateAssignment
in interface LoadBalancer
HBaseIOException
public ServerName randomAssignment(HRegionInfo region, List<ServerName> servers) throws HBaseIOException
LoadBalancer
randomAssignment
in interface LoadBalancer
region
- Region for which this selection is being done.HBaseIOException
public Set<HRegionInfo> getMisplacedRegions(Map<HRegionInfo,ServerName> regions) throws IOException
IOException
public void initialize() throws HBaseIOException
LoadBalancer
initialize
in interface LoadBalancer
HBaseIOException
public boolean isOnline()
public void regionOnline(HRegionInfo regionInfo, ServerName sn)
LoadBalancer
regionOnline
in interface LoadBalancer
public void regionOffline(HRegionInfo regionInfo)
LoadBalancer
regionOffline
in interface LoadBalancer
public void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserver
ConfigurationManager
object when the Configuration
object is reloaded from disk.onConfigurationChange
in interface ConfigurationObserver
onConfigurationChange
in interface LoadBalancer
public void stop(String why)
Stoppable
public boolean isStopped()
isStopped
in interface Stoppable
Stoppable.stop(String)
has been closed.public void postMasterStartupInitialize()
LoadBalancer
postMasterStartupInitialize
in interface LoadBalancer
public void updateBalancerStatus(boolean status)
updateBalancerStatus
in interface LoadBalancer
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.