@InterfaceAudience.Private public class MaintenanceLoadBalancer extends org.apache.hadoop.conf.Configured implements LoadBalancer
BOGUS_SERVER_NAME, SYSTEM_TABLES_ON_MASTER, TABLES_ON_MASTER| Constructor and Description |
|---|
MaintenanceLoadBalancer() |
| Modifier and Type | Method and Description |
|---|---|
List<RegionPlan> |
balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable)
Perform the major balance operation for cluster, will invoke
LoadBalancer.balanceTable(org.apache.hadoop.hbase.TableName, java.util.Map<org.apache.hadoop.hbase.ServerName, java.util.List<org.apache.hadoop.hbase.client.RegionInfo>>) to do actual
balance. |
List<RegionPlan> |
balanceTable(TableName tableName,
Map<ServerName,List<RegionInfo>> loadOfOneTable)
Perform the major balance operation for table, all class implement of
LoadBalancer
should override this method |
void |
initialize()
Initialize the load balancer.
|
boolean |
isStopped() |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf) |
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 |
setClusterMetrics(ClusterMetrics st)
Set the current cluster status.
|
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
void |
stop(String why) |
void |
updateBalancerStatus(boolean status) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisMasterCanHostUserRegions, isSystemTablesOnlyOnMaster, isTablesOnMasterpublic void setClusterMetrics(ClusterMetrics st)
LoadBalancersetClusterMetrics in interface LoadBalancerpublic void setMasterServices(MasterServices masterServices)
LoadBalancersetMasterServices in interface LoadBalancerpublic List<RegionPlan> balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable) throws IOException
LoadBalancerLoadBalancer.balanceTable(org.apache.hadoop.hbase.TableName, java.util.Map<org.apache.hadoop.hbase.ServerName, java.util.List<org.apache.hadoop.hbase.client.RegionInfo>>) to do actual
balance. Normally not need override this method, except SimpleLoadBalancer and
RSGroupBasedLoadBalancer.balanceCluster in interface LoadBalancerloadOfAllTable - region load of servers for all tableIOExceptionpublic List<RegionPlan> balanceTable(TableName tableName, Map<ServerName,List<RegionInfo>> loadOfOneTable)
LoadBalancerLoadBalancer
should override this methodbalanceTable in interface LoadBalancertableName - the table to be balancedloadOfOneTable - region load of servers for the specific one tablepublic 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.public 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)
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.