public class BalancedShardsAllocator extends AbstractComponent implements ShardsAllocator
BalancedShardsAllocator re-balances the nodes allocations
within an cluster based on a BalancedShardsAllocator.WeightFunction. The clusters balance is defined by four parameters which can be set
in the cluster update API that allows changes in real-time:
cluster.routing.allocation.balance.shard - The shard balance defines the weight factor
for shards allocated on a RoutingNodecluster.routing.allocation.balance.index - The index balance defines a factor to the number
of ShardRoutings per index allocated on a specific nodecluster.routing.allocation.balance.threshold - A threshold to set the minimal optimization
value of operations that should be performed
These parameters are combined in a BalancedShardsAllocator.WeightFunction that allows calculation of node weights which
are used to re-balance shards based on global as well as per-index factors.
| 修飾子とタイプ | クラスと説明 |
|---|---|
static class |
BalancedShardsAllocator.Balancer
|
static class |
BalancedShardsAllocator.WeightFunction
This class is the primary weight function used to create balanced over nodes and shards in the cluster.
|
| 修飾子とタイプ | フィールドと説明 |
|---|---|
static String |
SETTING_INDEX_BALANCE_FACTOR |
static String |
SETTING_SHARD_BALANCE_FACTOR |
static String |
SETTING_THRESHOLD |
deprecationLogger, logger, settings| コンストラクタと説明 |
|---|
BalancedShardsAllocator(Settings settings) |
BalancedShardsAllocator(Settings settings,
NodeSettingsService nodeSettingsService) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
boolean |
allocateUnassigned(RoutingAllocation allocation)
Assign all unassigned shards to nodes
|
void |
applyFailedShards(FailedRerouteAllocation allocation)
Applies changes on failed nodes based on the implemented algorithm.
|
void |
applyStartedShards(StartedRerouteAllocation allocation)
Applies changes on started nodes based on the implemented algorithm.
|
float |
getIndexBalance()
Returns the index related weight factor.
|
float |
getShardBalance()
Returns the shard related weight factor.
|
float |
getThreshold()
Returns the currently configured delta threshold
|
boolean |
moveShards(RoutingAllocation allocation)
Move started shards that can not be allocated to a node anymore
|
boolean |
rebalance(RoutingAllocation allocation)
Rebalancing number of shards on all nodes
|
logDeprecatedSetting, logRemovedSetting, nodeNamepublic BalancedShardsAllocator(Settings settings)
@Inject public BalancedShardsAllocator(Settings settings, NodeSettingsService nodeSettingsService)
public void applyStartedShards(StartedRerouteAllocation allocation)
ShardsAllocatorShardRoutingState.STARTED from ShardRoutingState.RELOCATING
this allocator might apply some cleanups on the node that used to hold the shard.applyStartedShards インタフェース内 ShardsAllocatorallocation - all started shardspublic void applyFailedShards(FailedRerouteAllocation allocation)
ShardsAllocatorapplyFailedShards インタフェース内 ShardsAllocatorallocation - all failed shardspublic boolean allocateUnassigned(RoutingAllocation allocation)
ShardsAllocatorallocateUnassigned インタフェース内 ShardsAllocatorallocation - current node allocationtrue if the allocation has changed, otherwise falsepublic boolean rebalance(RoutingAllocation allocation)
ShardsAllocatorrebalance インタフェース内 ShardsAllocatorallocation - current node allocationtrue if the allocation has changed, otherwise falsepublic boolean moveShards(RoutingAllocation allocation)
ShardsAllocatormoveShards インタフェース内 ShardsAllocatorallocation - current node allocationtrue if the allocation has changed, otherwise falsepublic float getThreshold()
public float getIndexBalance()
public float getShardBalance()
Copyright © 2009–2016. All rights reserved.