Class MaintenanceLoadBalancer
java.lang.Object
org.apache.hadoop.hbase.master.balancer.MaintenanceLoadBalancer
- All Implemented Interfaces:
ConfigurationObserver,LoadBalancer,Stoppable
a balancer which is only used in maintenance mode.
-
Field Summary
FieldsFields inherited from interface org.apache.hadoop.hbase.master.LoadBalancer
BOGUS_SERVER_NAME, SYSTEM_TABLES_ON_MASTER, TABLES_ON_MASTER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Map<ServerName,List<RegionInfo>> assign(Collection<RegionInfo> regions, List<ServerName> servers) balanceCluster(Map<TableName, Map<ServerName, List<RegionInfo>>> loadOfAllTable) Perform the major balance operation for cluster.voidInitialize the load balancer.booleanReturns True ifStoppable.stop(String)has been closed.voidonConfigurationChange(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.voidIf balancer needs to do initialization after Master has started up, lets do that here.randomAssignment(RegionInfo regionInfo, List<ServerName> servers) Get a random region server from the listvoidregionOffline(RegionInfo regionInfo) Marks the region as offline at balancer.voidregionOnline(RegionInfo regionInfo, ServerName sn) Marks the region as online at balancer.retainAssignment(Map<RegionInfo, ServerName> regions, List<ServerName> servers) Assign regions to the previously hosting region serverroundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) Perform a Round Robin assignment of regions.voidsetMasterServices(MasterServices masterServices) Set the master service.voidStop this service.voidupdateBalancerStatus(boolean status) voidSet the current cluster status.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.master.LoadBalancer
updateBalancerLoadInfo
-
Field Details
-
stopped
-
-
Constructor Details
-
MaintenanceLoadBalancer
public MaintenanceLoadBalancer()
-
-
Method Details
-
stop
Description copied from interface:StoppableStop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
isStopped
Description copied from interface:StoppableReturns True ifStoppable.stop(String)has been closed. -
updateClusterMetrics
Description copied from interface:LoadBalancerSet the current cluster status. This allows a LoadBalancer to map host name to a server- Specified by:
updateClusterMetricsin interfaceLoadBalancer
-
setMasterServices
Description copied from interface:LoadBalancerSet the master service.- Specified by:
setMasterServicesin interfaceLoadBalancer
-
balanceCluster
public List<RegionPlan> balanceCluster(Map<TableName, Map<ServerName, throws IOExceptionList<RegionInfo>>> loadOfAllTable) Description copied from interface:LoadBalancerPerform the major balance operation for cluster.- Specified by:
balanceClusterin interfaceLoadBalancer- Parameters:
loadOfAllTable- region load of servers for all table- Returns:
- a list of regions to be moved, including source and destination, or null if cluster is already balanced
- Throws:
IOException
-
assign
private Map<ServerName,List<RegionInfo>> assign(Collection<RegionInfo> regions, List<ServerName> servers) -
roundRobinAssignment
public Map<ServerName,List<RegionInfo>> roundRobinAssignment(List<RegionInfo> regions, List<ServerName> servers) Description copied from interface:LoadBalancerPerform a Round Robin assignment of regions.- Specified by:
roundRobinAssignmentin interfaceLoadBalancer- Returns:
- Map of servername to regioninfos
-
retainAssignment
public Map<ServerName,List<RegionInfo>> retainAssignment(Map<RegionInfo, ServerName> regions, List<ServerName> servers) Description copied from interface:LoadBalancerAssign regions to the previously hosting region server- Specified by:
retainAssignmentin interfaceLoadBalancer- Returns:
- List of plans
-
randomAssignment
Description copied from interface:LoadBalancerGet a random region server from the list- Specified by:
randomAssignmentin interfaceLoadBalancer- Parameters:
regionInfo- Region for which this selection is being done.
-
initialize
Description copied from interface:LoadBalancerInitialize the load balancer. Must be called after setters.- Specified by:
initializein interfaceLoadBalancer
-
regionOnline
Description copied from interface:LoadBalancerMarks the region as online at balancer.- Specified by:
regionOnlinein interfaceLoadBalancer
-
regionOffline
Description copied from interface:LoadBalancerMarks the region as offline at balancer.- Specified by:
regionOfflinein interfaceLoadBalancer
-
onConfigurationChange
Description copied from interface:ConfigurationObserverThis method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver- Specified by:
onConfigurationChangein interfaceLoadBalancer
-
postMasterStartupInitialize
Description copied from interface:LoadBalancerIf balancer needs to do initialization after Master has started up, lets do that here.- Specified by:
postMasterStartupInitializein interfaceLoadBalancer
-
updateBalancerStatus
- Specified by:
updateBalancerStatusin interfaceLoadBalancer
-