Module org.elasticsearch.server
Class BalancedShardsAllocator.Balancer
java.lang.Object
org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.Balancer
- Enclosing class:
BalancedShardsAllocator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSorts shards by desirability to move, sort order goes: Shards with write-load inBalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.threshold→BalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.maxWriteLoadOnNode(exclusive) Shards with write-load inBalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.threshold→ 0 Shards with write-load ==BalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.maxWriteLoadOnNodeShards with missing write-load e.g., for any twoShardRoutings,r1andr2,compare(r1, r2) > 0whenr2is more desirable to movecompare(r1, r2) == 0when the two shards are equally desirable to movecompare(r1, r2) < 0whenr1is more desirable to move -
Method Summary
Modifier and TypeMethodDescriptiondoublefloatReturns the global average of shards per nodefloatavgShardsPerNode(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index) Returns the average of shards per node for the given indexdoubledecideMove(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index, ShardRouting shardRouting) Makes a decision on whether to move a started shard to another node.booleanMove started shards that cannot be allocated to a node anymore, or are in a non-preferred allocation For each shard to be moved this function executes a move operation to the minimal eligible node with respect to the weight function.
-
Method Details
-
avgShardsPerNode
public float avgShardsPerNode(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index) Returns the average of shards per node for the given index -
avgShardsPerNode
public float avgShardsPerNode()Returns the global average of shards per node -
avgWriteLoadPerNode
public double avgWriteLoadPerNode() -
avgDiskUsageInBytesPerNode
public double avgDiskUsageInBytesPerNode() -
moveShards
public boolean moveShards()Move started shards that cannot be allocated to a node anymore, or are in a non-preferred allocation For each shard to be moved this function executes a move operation to the minimal eligible node with respect to the weight function. If a shard is moved the shard will be set toShardRoutingState.RELOCATINGand a shadow instance of this shard is created with an incremented version in the stateShardRoutingState.INITIALIZING. -
decideMove
public MoveDecision decideMove(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index, ShardRouting shardRouting) Makes a decision on whether to move a started shard to another node.This overload will always search for relocation targets for
Decision.NOT_PREFERREDallocations.- Parameters:
index- The index that the shard being considered belongs toshardRouting- The shard routing being considered for movement- Returns:
- The
MoveDecisionfor the shard - See Also:
-