public static class BalancedShardsAllocator.Balancer extends Object
Constructor and Description |
---|
Balancer(ESLogger logger,
RoutingAllocation allocation,
BalancedShardsAllocator.WeightFunction weight,
float threshold) |
Modifier and Type | Method and Description |
---|---|
float |
avgPrimariesPerNode()
Returns the global average of primaries per node
|
float |
avgPrimariesPerNode(String index)
Returns the average of primaries per node for the given index
|
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 |
move(MutableShardRouting shard,
RoutingNode node)
This function executes a move operation moving the given shard from
the given node to the minimal eligible node with respect to the
weight function.
|
public Balancer(ESLogger logger, RoutingAllocation allocation, BalancedShardsAllocator.WeightFunction weight, float threshold)
public float avgShardsPerNode(String index)
public float avgShardsPerNode()
public float avgPrimariesPerNode()
public float avgPrimariesPerNode(String index)
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 move(MutableShardRouting shard, RoutingNode node)
ShardRoutingState.RELOCATING
and a shadow instance of this
shard is created with an incremented version in the state
ShardRoutingState.INITIALIZING
.true
iff the shard has successfully been moved.Copyright © 2009–2015. All rights reserved.