@InterfaceAudience.LimitedPrivate(value="Configuration") 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)
.
Inline region placement with BaseLoadBalancer.immediateAssignment(java.util.List<org.apache.hadoop.hbase.HRegionInfo>, java.util.List<org.apache.hadoop.hbase.ServerName>)
can be used when
the Master needs to handle closed regions that it currently does not have
a destination set for. This can happen during master failover.
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.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SimpleLoadBalancer.BalanceInfo
Stores additional per-server information about the regions added/removed
during the run of the balancing algorithm.
|
BaseLoadBalancer.Cluster
Modifier and Type | Field and Description |
---|---|
private static org.apache.commons.logging.Log |
LOG |
private static Random |
RANDOM |
private RegionInfoComparator |
riComparator |
private RegionPlan.RegionPlanComparator |
rpComparator |
clusterStatus, config, masterServerName, metricsBalancer, rackManager, regionFinder, services, slop, TABLES_ON_MASTER, tablesOnMaster
Constructor and Description |
---|
SimpleLoadBalancer() |
Modifier and Type | Method and Description |
---|---|
private void |
addRegionPlan(com.google.common.collect.MinMaxPriorityQueue<RegionPlan> regionsToMove,
boolean fetchFromTail,
ServerName sn,
List<RegionPlan> regionsToReturn)
Add a region from the head or tail to the List of regions to return.
|
List<RegionPlan> |
balanceCluster(Map<ServerName,List<HRegionInfo>> clusterMap)
Generate a global load balancing plan according to the specified map of
server information to the most loaded regions of each server.
|
areSomeRegionReplicasColocated, assignMasterRegions, balanceMasterRegions, createCluster, getConf, getRegionAssignmentsByServer, getTablesOnMaster, immediateAssignment, initialize, isStopped, needsBalance, onConfigurationChange, randomAssignment, regionOffline, regionOnline, retainAssignment, roundRobinAssignment, setClusterStatus, setConf, setMasterServices, setRackManager, setSlop, shouldBeOnMaster, stop, tablesOnMaster
private static final org.apache.commons.logging.Log LOG
private static final Random RANDOM
private RegionInfoComparator riComparator
private RegionPlan.RegionPlanComparator rpComparator
public List<RegionPlan> balanceCluster(Map<ServerName,List<HRegionInfo>> 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 regionsprivate void addRegionPlan(com.google.common.collect.MinMaxPriorityQueue<RegionPlan> regionsToMove, boolean fetchFromTail, ServerName sn, List<RegionPlan> regionsToReturn)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.