@InterfaceAudience.Private public class MaintenanceLoadBalancer extends Object implements LoadBalancer
| Modifier and Type | Field and Description |
|---|---|
private boolean |
stopped |
BOGUS_SERVER_NAME, SYSTEM_TABLES_ON_MASTER, TABLES_ON_MASTER| Constructor and Description |
|---|
MaintenanceLoadBalancer() |
| Modifier and Type | Method and Description |
|---|---|
private Map<ServerName,List<RegionInfo>> |
assign(Collection<RegionInfo> regions,
List<ServerName> servers) |
List<RegionPlan> |
balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable)
Perform the major balance operation for cluster.
|
void |
initialize()
Initialize the load balancer.
|
boolean |
isStopped()
Returns True if
Stoppable.stop(String) has been closed. |
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 nn * @return List of plans
|
Map<ServerName,List<RegionInfo>> |
roundRobinAssignment(List<RegionInfo> regions,
List<ServerName> servers)
Perform a Round Robin assignment of regions.
|
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
void |
stop(String why)
Stop this service.
|
void |
updateBalancerStatus(boolean status) |
void |
updateClusterMetrics(ClusterMetrics st)
Set the current cluster status.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisMasterCanHostUserRegions, isSystemTablesOnlyOnMaster, isTablesOnMaster, updateBalancerLoadInfoprivate volatile boolean stopped
public MaintenanceLoadBalancer()
public void stop(String why)
Stoppablepublic boolean isStopped()
StoppableStoppable.stop(String) has been closed.public void updateClusterMetrics(ClusterMetrics st)
LoadBalancerupdateClusterMetrics in interface LoadBalancerpublic void setMasterServices(MasterServices masterServices)
LoadBalancersetMasterServices in interface LoadBalancerpublic List<RegionPlan> balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable) throws IOException
LoadBalancerbalanceCluster in interface LoadBalancerloadOfAllTable - region load of servers for all tableIOExceptionprivate Map<ServerName,List<RegionInfo>> assign(Collection<RegionInfo> regions, List<ServerName> servers)
public Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers)
LoadBalancerroundRobinAssignment in interface LoadBalancerpublic Map<ServerName,List<RegionInfo>> retainAssignment(Map<RegionInfo,ServerName> regions, List<ServerName> servers)
LoadBalancerretainAssignment in interface LoadBalancerpublic ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers)
LoadBalancerrandomAssignment in interface LoadBalancerregionInfo - Region for which this selection is being done. nnpublic void initialize()
LoadBalancerinitialize in interface LoadBalancerpublic void regionOnline(RegionInfo regionInfo, ServerName sn)
LoadBalancerregionOnline in interface LoadBalancerpublic void regionOffline(RegionInfo regionInfo)
LoadBalancerregionOffline in interface LoadBalancerpublic void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserverConfigurationManager object when the
Configuration object is reloaded from disk.onConfigurationChange in interface ConfigurationObserveronConfigurationChange in interface LoadBalancerpublic void postMasterStartupInitialize()
LoadBalancerpostMasterStartupInitialize in interface LoadBalancerpublic void updateBalancerStatus(boolean status)
updateBalancerStatus in interface LoadBalancerCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.