Class HostRegexTableLoadBalancer
- All Implemented Interfaces:
TabletBalancer
Regex properties for this balancer are specified as:
table.custom.balancer.host.regex.<tablename>=<regex>
Periodically (default 5m) this balancer will check to see if a tablet server is hosting tablets that it should not be according to the regex configuration. If this occurs then the offending tablets will be reassigned. This would cover the case where the configuration is changed and the manager is restarted while the tablet servers are up. To change the out of bounds check time period, set the following property:
table.custom.balancer.host.regex.oob.period=5m
Regex matching can be based on either the host name (default) or host ip address. To set this balancer to match the regular expressions to the tablet server IP address, then set the following property:
table.custom.balancer.host.regex.is.ip=true
It's possible that this balancer may create a lot of migrations. To limit the number of migrations that are created during a balance call, set the following property (default 250):
table.custom.balancer.host.regex.concurrent.migrations This balancer can continue balancing even if there are outstanding migrations. To limit the number of outstanding migrations in which this balancer will continue balancing, set the following property (default 0):
table.custom.balancer.host.regex.max.outstanding.migrations
- Since:
- 2.1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.accumulo.core.spi.balancer.TabletBalancer
TabletBalancer.AssignmentParameters, TabletBalancer.BalanceParameters, TabletBalancer.CurrentAssignment -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.Deprecated.Fields inherited from class org.apache.accumulo.core.spi.balancer.TableLoadBalancer
environment, TABLE_ASSIGNMENT_GROUP_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongDeprecated.Ask the balancer if any migrations are necessary.voidDeprecated.Assign tablets to tablet servers.intDeprecated.intDeprecated.protected StringgetNameFromIp(String hostIp) Deprecated.protected List<TabletStatistics> getOnlineTabletsForTable(TabletServerId tabletServerId, TableId tableId) Deprecated.longDeprecated.protected StringgetPoolNameForTable(String tableName) Deprecated.Matches table name against pool names, returns matching pool name or DEFAULT_POOL.getPoolNamesForHost(TabletServerId tabletServerId) Deprecated.Matches host against the regexes and returns the matching pool namesDeprecated.voidinit(BalancerEnvironment balancerEnvironment) Deprecated.Initialize the TabletBalancer.booleanDeprecated.booleanneedsReassignment(TabletBalancer.CurrentAssignment currentAssignment) Deprecated.The manager periodically scans all tablets looking for tablets that are assigned to dead tablet servers or unassigned.protected Map<String, SortedMap<TabletServerId, TServerStatus>> Deprecated.Group the set of current tservers by pool name.toString()Deprecated.Methods inherited from class org.apache.accumulo.core.spi.balancer.TableLoadBalancer
getBalancerForTable, getLoadBalancerClassNameForTable, getResourceGroupNameForTable
-
Field Details
-
HOST_BALANCER_PREFIX
Deprecated. -
HOST_BALANCER_OOB_CHECK_KEY
Deprecated. -
HOST_BALANCER_REGEX_USING_IPS_KEY
Deprecated. -
HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY
Deprecated. -
DEFAULT_POOL
Deprecated.- See Also:
-
HOST_BALANCER_OUTSTANDING_MIGRATIONS_KEY
Deprecated. -
lastOOBCheckTimes
protected final Map<org.apache.accumulo.core.metadata.schema.Ample.DataLevel,Long> lastOOBCheckTimesDeprecated.
-
-
Constructor Details
-
HostRegexTableLoadBalancer
public HostRegexTableLoadBalancer()Deprecated.
-
-
Method Details
-
splitCurrentByRegex
protected Map<String,SortedMap<TabletServerId, splitCurrentByRegexTServerStatus>> (SortedMap<TabletServerId, TServerStatus> current) Deprecated.Group the set of current tservers by pool name. Tservers that don't match a regex are put into a default pool. This could be expensive in the terms of the amount of time to recompute the groups, so HOST_BALANCER_POOL_RECHECK_KEY should be specified in the terms of minutes, not seconds or less.- Parameters:
current- map of current tservers- Returns:
- current servers grouped by pool name, if not a match it is put into a default pool.
-
getPoolNamesForHost
Deprecated.Matches host against the regexes and returns the matching pool names- Parameters:
tabletServerId- tablet server host- Returns:
- pool names, will return default pool if host matches more no regex
-
getNameFromIp
Deprecated.- Throws:
UnknownHostException
-
getPoolNameForTable
Deprecated.Matches table name against pool names, returns matching pool name or DEFAULT_POOL.- Parameters:
tableName- name of table- Returns:
- tablet server pool name (table name or DEFAULT_POOL)
-
toString
Deprecated. -
getPoolNameToRegexPattern
Deprecated. -
getMaxMigrations
public int getMaxMigrations()Deprecated. -
getMaxOutstandingMigrations
public int getMaxOutstandingMigrations()Deprecated. -
getOobCheckMillis
public long getOobCheckMillis()Deprecated. -
isIpBasedRegex
public boolean isIpBasedRegex()Deprecated. -
init
Deprecated.Description copied from interface:TabletBalancerInitialize the TabletBalancer. This gives the balancer the opportunity to read the configuration.- Specified by:
initin interfaceTabletBalancer- Overrides:
initin classTableLoadBalancer
-
getAssignments
Deprecated.Description copied from interface:TabletBalancerAssign tablets to tablet servers. This method is called whenever the manager finds tablets that are unassigned.- Specified by:
getAssignmentsin interfaceTabletBalancer- Overrides:
getAssignmentsin classTableLoadBalancer
-
balance
Deprecated.Description copied from interface:TabletBalancerAsk the balancer if any migrations are necessary. If the balancer is going to self-abort due to some environmental constraint (e.g. it requires some minimum number of tservers, or a maximum number of outstanding migrations), it should issue a log message to alert operators. The message should be at WARN normally and at ERROR if the balancer knows that the problem can not self correct. It should not issue these messages more than once a minute. This method will not be called when there are unassigned tablets.- Specified by:
balancein interfaceTabletBalancer- Overrides:
balancein classTableLoadBalancer- Returns:
- the time, in milliseconds, to wait before re-balancing.
-
getOnlineTabletsForTable
protected List<TabletStatistics> getOnlineTabletsForTable(TabletServerId tabletServerId, TableId tableId) throws AccumuloSecurityException, AccumuloException Deprecated. -
needsReassignment
Deprecated.Description copied from interface:TabletBalancerThe manager periodically scans all tablets looking for tablets that are assigned to dead tablet servers or unassigned. During the scan this method is also called for tablets that are currently assigned to a live tserver to see if they should be unassigned and reassigned. If this method returns true the tablet will be unloaded from the tablet sever and then later the tablet will be passed to
TabletBalancer.getAssignments(AssignmentParameters).One example use case for this method is a balancer that partitions tablet servers into groups. If the balancers config is changed such that a table that was assigned to tablet server group A should now be assigned to tablet server B, then this method can return true for the tablets in that table assigned to tablet server group A. After those tablets are unloaded and passed to the
TabletBalancer.getAssignments(AssignmentParameters)method it can reassign them to tablet server group B.Accumulo may instantiate this plugin in different processes and call this method. When the manager looks for tablets that needs reassignment it currently uses an Accumulo iterator to scan the metadata table and filter tablets. That iterator may run on multiple tablets servers and call this plugin. Keep this in mind when implementing this plugin and considering keeping state between calls to this method.
This new method may be used instead of or in addition to
TabletBalancer.balance(BalanceParameters)- Specified by:
needsReassignmentin interfaceTabletBalancer- Overrides:
needsReassignmentin classTableLoadBalancer
-
TableLoadBalanceras it provides similar functionality using server process resource group parameters.