public static class BalancedShardsAllocator.Balancer extends Object
Constructor and Description |
---|
BalancedShardsAllocator.Balancer(ESLogger logger,
RoutingAllocation allocation,
BalancedShardsAllocator.WeightFunction weight,
float threshold) |
Modifier and Type | Method and Description |
---|---|
float |
avgShardsPerNode()
Returns the global average of shards per node
|
float |
avgShardsPerNode(String index)
Returns the average of shards per node for the given index
|
boolean |
balance()
Balances the nodes on the cluster model according to the weight
function.
|
boolean |
moveShards()
Move started shards that can not be allocated to a node anymore
For each shard to be moved this function executes a move operation
to the minimal eligible node with respect to the
weight function.
|
public BalancedShardsAllocator.Balancer(ESLogger logger, RoutingAllocation allocation, BalancedShardsAllocator.WeightFunction weight, float threshold)
public float avgShardsPerNode(String index)
public float avgShardsPerNode()
public boolean balance()
BalancedShardsAllocator.WeightFunction
. This weight is calculated per index to
distribute shards evenly per index. The balancer tries to relocate
shards only if the delta exceeds the threshold. If the default case
the threshold is set to 1.0 to enforce gaining relocation
only, or in other words relocations that move the weight delta closer
to 0.0true
if the current configuration has been
changed, otherwise false
public boolean moveShards()
ShardRoutingState.RELOCATING
and a shadow instance of this
shard is created with an incremented version in the state
ShardRoutingState.INITIALIZING
.true
if the allocation has changed, otherwise false
Copyright © 2009–2017. All rights reserved.