|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.master.DefaultLoadBalancer
public class DefaultLoadBalancer
Makes decisions about the placement and movement of Regions across RegionServers.
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 immediateAssignment(java.util.List 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.
| Constructor Summary | |
|---|---|
DefaultLoadBalancer()
|
|
| Method Summary | |
|---|---|
List<RegionPlan> |
balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState)
Generate a global load balancing plan according to the specified map of server information to the most loaded regions of each server. |
org.apache.hadoop.conf.Configuration |
getConf()
|
Map<HRegionInfo,ServerName> |
immediateAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
Generates an immediate assignment plan to be used by a new master for regions in transition that do not have an already known destination. |
ServerName |
randomAssignment(List<ServerName> servers)
Get a random region server from the list |
Map<ServerName,List<HRegionInfo>> |
retainAssignment(Map<HRegionInfo,ServerName> regions,
List<ServerName> servers)
Generates a bulk assignment startup plan, attempting to reuse the existing assignment information from META, but adjusting for the specified list of available/online servers available for assignment. |
Map<ServerName,List<HRegionInfo>> |
roundRobinAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
Generates a bulk assignment plan to be used on cluster startup using a simple round-robin assignment. |
void |
setClusterStatus(ClusterStatus st)
Set the current cluster status. |
void |
setConf(org.apache.hadoop.conf.Configuration conf)
|
void |
setMasterServices(MasterServices masterServices)
Set the master service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultLoadBalancer()
| Method Detail |
|---|
public void setClusterStatus(ClusterStatus st)
LoadBalancer
setClusterStatus in interface LoadBalancerpublic void setMasterServices(MasterServices masterServices)
LoadBalancer
setMasterServices in interface LoadBalancerpublic void setConf(org.apache.hadoop.conf.Configuration conf)
setConf in interface org.apache.hadoop.conf.Configurablepublic org.apache.hadoop.conf.Configuration getConf()
getConf in interface org.apache.hadoop.conf.Configurablepublic List<RegionPlan> balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState)
Order the regions to move from most recent to least.
balanceCluster in interface LoadBalancerclusterState - Map of regionservers and their load/region information to
a list of their most loaded regions
public Map<ServerName,List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
Takes a list of all the regions and all the servers in the cluster and returns a map of each server to the regions that it should be assigned.
Currently implemented as a round-robin assignment. Same invariant as load balancing, all servers holding floor(avg) or ceiling(avg). TODO: Use block locations from HDFS to place regions with their blocks
roundRobinAssignment in interface LoadBalancerregions - all regionsservers - all servers
public Map<ServerName,List<HRegionInfo>> retainAssignment(Map<HRegionInfo,ServerName> regions,
List<ServerName> servers)
Takes a map of all regions to their existing assignment from META. Also takes a list of online servers for regions to be assigned to. Attempts to retain all assignment, so in some instances initial assignment will not be completely balanced.
Any leftover regions without an existing server to be assigned to will be assigned randomly to available servers.
retainAssignment in interface LoadBalancerregions - regions and existing assignment from metaservers - available servers
public Map<HRegionInfo,ServerName> immediateAssignment(List<HRegionInfo> regions,
List<ServerName> servers)
immediateAssignment in interface LoadBalancerregions - servers -
public ServerName randomAssignment(List<ServerName> servers)
LoadBalancer
randomAssignment in interface LoadBalancer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||