Class BalancedShardsAllocator.Balancer

java.lang.Object
org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.Balancer
Enclosing class:
BalancedShardsAllocator

public static class BalancedShardsAllocator.Balancer extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Sorts shards by desirability to move, sort order goes: Shards with write-load in BalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.thresholdBalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.maxWriteLoadOnNode (exclusive) Shards with write-load in BalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.threshold → 0 Shards with write-load == BalancedShardsAllocator.Balancer.PrioritiseByShardWriteLoadComparator.maxWriteLoadOnNode Shards with missing write-load e.g., for any two ShardRoutings, r1 and r2, compare(r1, r2) > 0 when r2 is more desirable to move compare(r1, r2) == 0 when the two shards are equally desirable to move compare(r1, r2) < 0 when r1 is more desirable to move
  • Method Summary

    Modifier and Type
    Method
    Description
    double
     
    float
    Returns the global average of shards per node
    float
    avgShardsPerNode(org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ProjectIndex index)
    Returns the average of shards per node for the given index
    double
     
    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.
    boolean
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 to ShardRoutingState.RELOCATING and a shadow instance of this shard is created with an incremented version in the state ShardRoutingState.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_PREFERRED allocations.

      Parameters:
      index - The index that the shard being considered belongs to
      shardRouting - The shard routing being considered for movement
      Returns:
      The MoveDecision for the shard
      See Also:
      • decideMove(ProjectIndex, ShardRouting, Predicate)