@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).
 
On cluster startup, bulk assignment can be used to determine locations for all Regions in a cluster.
This class produces plans for the
 AssignmentManager
 to execute.
| Modifier and Type | Field and Description | 
|---|---|
| static ServerName | BOGUS_SERVER_NAME | 
| static String | SYSTEM_TABLES_ON_MASTERDeprecated. 
 since 2.4.0, will be removed in 3.0.0. | 
| static String | TABLES_ON_MASTERDeprecated. 
 since 2.4.0, will be removed in 3.0.0. | 
| 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  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  LoadBalancershould override this method | 
| void | initialize()Initialize the load balancer. | 
| static boolean | isMasterCanHostUserRegions(org.apache.hadoop.conf.Configuration conf)Deprecated. 
 since 2.4.0, will be removed in 3.0.0. | 
| static boolean | isSystemTablesOnlyOnMaster(org.apache.hadoop.conf.Configuration conf)Deprecated. 
 since 2.4.0, will be removed in 3.0.0. | 
| static boolean | isTablesOnMaster(org.apache.hadoop.conf.Configuration conf)Deprecated. 
 since 2.4.0, will be removed in 3.0.0. | 
| void | onConfigurationChange(org.apache.hadoop.conf.Configuration conf)This method would be called by the  ConfigurationManagerobject when theConfigurationobject 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 | 
| 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 | updateBalancerStatus(boolean status) | 
@Deprecated static final String TABLES_ON_MASTER
@Deprecated static final String SYSTEM_TABLES_ON_MASTER
static final ServerName BOGUS_SERVER_NAME
void setClusterMetrics(ClusterMetrics st)
st - void setMasterServices(MasterServices masterServices)
masterServices - List<RegionPlan> balanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable) throws IOException
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.loadOfAllTable - region load of servers for all tableIOExceptionList<RegionPlan> balanceTable(TableName tableName, Map<ServerName,List<RegionInfo>> loadOfOneTable)
LoadBalancer
 should override this methodtableName - the table to be balancedloadOfOneTable - region load of servers for the specific one table@NonNull Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) throws HBaseIOException
regions - servers - HBaseIOException@NonNull Map<ServerName,List<RegionInfo>> retainAssignment(Map<RegionInfo,ServerName> regions, List<ServerName> servers) throws HBaseIOException
regions - servers - HBaseIOExceptionServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers) throws HBaseIOException
regionInfo - Region for which this selection is being done.servers - HBaseIOExceptionvoid initialize() throws HBaseIOException
HBaseIOExceptionvoid regionOnline(RegionInfo regionInfo, ServerName sn)
regionInfo - sn - void regionOffline(RegionInfo regionInfo)
regionInfo - void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserverConfigurationManager
 object when the Configuration object is reloaded from disk.onConfigurationChange in interface ConfigurationObservervoid postMasterStartupInitialize()
void updateBalancerStatus(boolean status)
@Deprecated static boolean isTablesOnMaster(org.apache.hadoop.conf.Configuration conf)
@Deprecated static boolean isSystemTablesOnlyOnMaster(org.apache.hadoop.conf.Configuration conf)
@Deprecated static boolean isMasterCanHostUserRegions(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.