@InterfaceAudience.LimitedPrivate(value="Configuration") public class FavoredNodeLoadBalancer extends BaseLoadBalancer implements FavoredNodesPromoter
LoadBalancer that
assigns favored nodes for each region. There is a Primary RegionServer that hosts
the region, and then there is Secondary and Tertiary RegionServers. Currently, the
favored nodes information is used in creating HDFS files - the Primary RegionServer
passes the primary, secondary, tertiary node addresses as hints to the
DistributedFileSystem API for creating files on the filesystem. These nodes are
treated as hints by the HDFS to place the blocks of the file. This alleviates the
problem to do with reading from remote nodes (since we can make the Secondary
RegionServer as the new Primary RegionServer) after a region is recovered. This
should help provide consistent read latencies for the regions even when their
primary region servers die.BaseLoadBalancer.ClusterclusterStatus, config, maintenanceMode, masterServerName, metricsBalancer, MIN_SERVER_BALANCE, onlySystemTablesOnMaster, overallSlop, regionFinder, services, slop, useRegionFinderFAVORED_ALWAYS_ASSIGN_REGIONSBOGUS_SERVER_NAME, SYSTEM_TABLES_ON_MASTER, TABLES_ON_MASTER| 构造器和说明 |
|---|
FavoredNodeLoadBalancer() |
| 限定符和类型 | 方法和说明 |
|---|---|
List<RegionPlan> |
balanceCluster(Map<ServerName,List<RegionInfo>> clusterState)
Perform the major balance operation
|
List<RegionPlan> |
balanceCluster(TableName tableName,
Map<ServerName,List<RegionInfo>> clusterState)
Perform the major balance operation
|
void |
generateFavoredNodesForDaughter(List<ServerName> servers,
RegionInfo parent,
RegionInfo regionA,
RegionInfo regionB) |
void |
generateFavoredNodesForMergedRegion(RegionInfo merged,
RegionInfo regionA,
RegionInfo regionB) |
List<ServerName> |
getFavoredNodes(RegionInfo regionInfo) |
void |
initialize()
Initialize the load balancer.
|
ServerName |
randomAssignment(RegionInfo regionInfo,
List<ServerName> servers)
Used to assign a single region to a random server.
|
Map<ServerName,List<RegionInfo>> |
roundRobinAssignment(List<RegionInfo> regions,
List<ServerName> servers)
Generates a bulk assignment plan to be used on cluster startup using a
simple round-robin assignment.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
areSomeRegionReplicasColocated, assignMasterSystemRegions, balanceMasterRegions, createCluster, getConf, getRegionAssignmentsByServer, isStopped, needsBalance, onConfigurationChange, postMasterStartupInitialize, regionOffline, regionOnline, retainAssignment, setClusterLoad, setClusterMetrics, setMasterServices, setRackManager, setSlop, shouldBeOnMaster, stop, updateBalancerStatusclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisMasterCanHostUserRegions, isSystemTablesOnlyOnMaster, isTablesOnMasterpublic void setConf(org.apache.hadoop.conf.Configuration conf)
setConf 在接口中 org.apache.hadoop.conf.ConfigurablesetConf 在类中 BaseLoadBalancerpublic void initialize()
throws HBaseIOException
LoadBalancerinitialize 在接口中 LoadBalancerinitialize 在类中 BaseLoadBalancerHBaseIOExceptionpublic List<RegionPlan> balanceCluster(Map<ServerName,List<RegionInfo>> clusterState)
LoadBalancerbalanceCluster 在接口中 LoadBalancerpublic Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) throws HBaseIOException
BaseLoadBalancerTakes 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 在接口中 LoadBalancerroundRobinAssignment 在类中 BaseLoadBalancerregions - all regionsservers - all serversHBaseIOExceptionpublic ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers) throws HBaseIOException
BaseLoadBalancerrandomAssignment 在接口中 LoadBalancerrandomAssignment 在类中 BaseLoadBalancerregionInfo - Region for which this selection is being done.HBaseIOExceptionpublic List<ServerName> getFavoredNodes(RegionInfo regionInfo)
public void generateFavoredNodesForDaughter(List<ServerName> servers, RegionInfo parent, RegionInfo regionA, RegionInfo regionB) throws IOException
generateFavoredNodesForDaughter 在接口中 FavoredNodesPromoterIOExceptionpublic void generateFavoredNodesForMergedRegion(RegionInfo merged, RegionInfo regionA, RegionInfo regionB) throws IOException
public List<RegionPlan> balanceCluster(TableName tableName, Map<ServerName,List<RegionInfo>> clusterState) throws HBaseIOException
LoadBalancerbalanceCluster 在接口中 LoadBalancerHBaseIOExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.