@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.BALANCER_DECISION_BUFFER_ENABLED, BALANCER_REJECTION_BUFFER_ENABLED, clusterStatus, DEFAULT_BALANCER_DECISION_BUFFER_ENABLED, DEFAULT_BALANCER_REJECTION_BUFFER_ENABLED, DEFAULT_HBASE_MASTER_LOADBALANCE_BYTABLE, isByTable, masterServerName, metricsBalancer, MIN_SERVER_BALANCE, provider, rackManager, regionFinder, slop, useRegionFinderFAVORED_ALWAYS_ASSIGN_REGIONSBOGUS_SERVER_NAME, HBASE_RSGROUP_LOADBALANCER_CLASS| Constructor and Description |
|---|
FavoredNodeLoadBalancer() |
| Modifier and Type | Method and Description |
|---|---|
protected List<RegionPlan> |
balanceTable(TableName tableName,
Map<ServerName,List<RegionInfo>> loadOfOneTable)
Perform the major balance operation for table, all sub classes should override this method.
|
void |
generateFavoredNodesForDaughter(List<ServerName> servers,
RegionInfo parent,
RegionInfo regionA,
RegionInfo regionB) |
void |
generateFavoredNodesForMergedRegion(RegionInfo merged,
RegionInfo[] mergeParents) |
List<ServerName> |
getFavoredNodes(RegionInfo regionInfo) |
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 |
setFavoredNodesManager(FavoredNodesManager fnm) |
balanceCluster, getConf, getDefaultSlop, idleRegionServerExist, initialize, isStopped, loadConf, onConfigurationChange, postMasterStartupInitialize, preBalanceCluster, regionOffline, regionOnline, retainAssignment, setClusterInfoProvider, sloppyRegionServerExist, stop, toEnsumbleTableLoad, updateBalancerStatus, updateClusterMetricsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitupdateBalancerLoadInfopublic void setFavoredNodesManager(FavoredNodesManager fnm)
setFavoredNodesManager in interface FavoredNodesPromoterprotected List<RegionPlan> balanceTable(TableName tableName, Map<ServerName,List<RegionInfo>> loadOfOneTable)
BaseLoadBalancerBaseLoadBalancer.balanceCluster(Map). If
HConstants.HBASE_MASTER_LOADBALANCE_BYTABLE is enabled, we will call this method
multiple times, one table a time, where we will only pass in the regions for a single table
each time. If not, we will pass in all the regions at once, and the tableName will be
HConstants.ENSEMBLE_TABLE_NAME.balanceTable in class BaseLoadBalancertableName - the table to be balancedloadOfOneTable - region load of servers for the specific one table@NonNull public Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) throws HBaseIOException
BaseLoadBalancerroundRobinAssignment in interface LoadBalancerroundRobinAssignment in class BaseLoadBalancerregions - all regionsservers - all serversHBaseIOExceptionpublic ServerName randomAssignment(RegionInfo regionInfo, List<ServerName> servers) throws HBaseIOException
BaseLoadBalancerrandomAssignment in interface LoadBalancerrandomAssignment in class BaseLoadBalancerregionInfo - Region for which this selection is being done.HBaseIOExceptionpublic List<ServerName> getFavoredNodes(RegionInfo regionInfo)
getFavoredNodes in interface FavoredNodesPromoterpublic void generateFavoredNodesForDaughter(List<ServerName> servers, RegionInfo parent, RegionInfo regionA, RegionInfo regionB) throws IOException
generateFavoredNodesForDaughter in interface FavoredNodesPromoterIOExceptionpublic void generateFavoredNodesForMergedRegion(RegionInfo merged, RegionInfo[] mergeParents) throws IOException
generateFavoredNodesForMergedRegion in interface FavoredNodesPromoterIOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.