public class SimpleLoadBalancer extends BaseLoadBalancer
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 classes produces plans for the
AssignmentManager to execute.
BaseLoadBalancer.ClusterclusterStatus, config, masterServerName, metricsBalancer, MIN_SERVER_BALANCE, onlySystemTablesOnMaster, overallSlop, rackManager, regionFinder, services, slop, tablesOnMaster, useRegionFinderBOGUS_SERVER_NAME, SYSTEM_TABLES_ON_MASTER, TABLES_ON_MASTER| Constructor and Description |
|---|
SimpleLoadBalancer() |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<RegionPlan> |
balanceCluster(java.util.Map<ServerName,java.util.List<RegionInfo>> clusterMap)
Generate a global load balancing plan according to the specified map of
server information to the most loaded regions of each server.
|
java.util.List<RegionPlan> |
balanceCluster(TableName tableName,
java.util.Map<ServerName,java.util.List<RegionInfo>> clusterState)
Perform the major balance operation
|
void |
balanceOverall(java.util.List<RegionPlan> regionsToReturn,
java.util.Map<ServerName,org.apache.hadoop.hbase.master.balancer.SimpleLoadBalancer.BalanceInfo> serverBalanceInfo,
boolean fetchFromTail,
<any> regionsToMove,
int max,
int min)
If we need to balanceoverall, we need to add one more round to peel off one region from each max.
|
void |
onConfigurationChange(Configuration conf)
This method would be called by the
ConfigurationManager
object when the Configuration object is reloaded from disk. |
void |
setClusterLoad(java.util.Map<TableName,java.util.Map<ServerName,java.util.List<RegionInfo>>> clusterLoad)
Pass RegionStates and allow balancer to set the current cluster load.
|
areSomeRegionReplicasColocated, assignMasterSystemRegions, balanceMasterRegions, createCluster, getConf, getRegionAssignmentsByServer, initialize, isStopped, needsBalance, postMasterStartupInitialize, randomAssignment, regionOffline, regionOnline, retainAssignment, roundRobinAssignment, setClusterMetrics, setConf, setMasterServices, setRackManager, setSlop, shouldBeOnMaster, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisSystemTablesOnlyOnMaster, isTablesOnMasterpublic void setClusterLoad(java.util.Map<TableName,java.util.Map<ServerName,java.util.List<RegionInfo>>> clusterLoad)
LoadBalancersetClusterLoad in interface LoadBalancersetClusterLoad in class BaseLoadBalancerpublic void onConfigurationChange(Configuration conf)
ConfigurationObserverConfigurationManager
object when the Configuration object is reloaded from disk.onConfigurationChange in interface ConfigurationObserveronConfigurationChange in interface LoadBalanceronConfigurationChange in class BaseLoadBalancerpublic java.util.List<RegionPlan> balanceCluster(java.util.Map<ServerName,java.util.List<RegionInfo>> clusterMap)
Order the regions to move from most recent to least.
clusterMap - Map of regionservers and their load/region information to
a list of their most loaded regionspublic void balanceOverall(java.util.List<RegionPlan> regionsToReturn, java.util.Map<ServerName,org.apache.hadoop.hbase.master.balancer.SimpleLoadBalancer.BalanceInfo> serverBalanceInfo, boolean fetchFromTail, <any> regionsToMove, int max, int min)
public java.util.List<RegionPlan> balanceCluster(TableName tableName, java.util.Map<ServerName,java.util.List<RegionInfo>> clusterState) throws HBaseIOException
LoadBalancerHBaseIOException