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
Fields inherited from interface org.apache.hadoop.hbase.master.LoadBalancer
BOGUS_SERVER_NAME, SYSTEM_TABLES_ON_MASTER, TABLES_ON_MASTER
-
Constructor Summary
-
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.void
Initialize the load balancer.boolean
Returns True ifStoppable.stop(String)
has been closed.void
onConfigurationChange
(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.void
If 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 listvoid
regionOffline
(RegionInfo regionInfo) Marks the region as offline at balancer.void
regionOnline
(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.void
setMasterServices
(MasterServices masterServices) Set the master service.void
Stop this service.void
updateBalancerStatus
(boolean status) void
Set the current cluster status.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:Stoppable
Stop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
isStopped
Description copied from interface:Stoppable
Returns True ifStoppable.stop(String)
has been closed. -
updateClusterMetrics
Description copied from interface:LoadBalancer
Set the current cluster status. This allows a LoadBalancer to map host name to a server- Specified by:
updateClusterMetrics
in interfaceLoadBalancer
-
setMasterServices
Description copied from interface:LoadBalancer
Set the master service.- Specified by:
setMasterServices
in interfaceLoadBalancer
-
balanceCluster
public List<RegionPlan> balanceCluster(Map<TableName, Map<ServerName, throws IOExceptionList<RegionInfo>>> loadOfAllTable) Description copied from interface:LoadBalancer
Perform the major balance operation for cluster.- Specified by:
balanceCluster
in 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:LoadBalancer
Perform a Round Robin assignment of regions.- Specified by:
roundRobinAssignment
in 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:LoadBalancer
Assign regions to the previously hosting region server- Specified by:
retainAssignment
in interfaceLoadBalancer
- Returns:
- List of plans
-
randomAssignment
Description copied from interface:LoadBalancer
Get a random region server from the list- Specified by:
randomAssignment
in interfaceLoadBalancer
- Parameters:
regionInfo
- Region for which this selection is being done.
-
initialize
Description copied from interface:LoadBalancer
Initialize the load balancer. Must be called after setters.- Specified by:
initialize
in interfaceLoadBalancer
-
regionOnline
Description copied from interface:LoadBalancer
Marks the region as online at balancer.- Specified by:
regionOnline
in interfaceLoadBalancer
-
regionOffline
Description copied from interface:LoadBalancer
Marks the region as offline at balancer.- Specified by:
regionOffline
in interfaceLoadBalancer
-
onConfigurationChange
Description copied from interface:ConfigurationObserver
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
- Specified by:
onConfigurationChange
in interfaceLoadBalancer
-
postMasterStartupInitialize
Description copied from interface:LoadBalancer
If balancer needs to do initialization after Master has started up, lets do that here.- Specified by:
postMasterStartupInitialize
in interfaceLoadBalancer
-
updateBalancerStatus
- Specified by:
updateBalancerStatus
in interfaceLoadBalancer
-