Class BalancedShardsAllocator.WeightFunction
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.WeightFunction
-
- Enclosing class:
- BalancedShardsAllocator
public static class BalancedShardsAllocator.WeightFunction extends java.lang.Object
This class is the primary weight function used to create balanced over nodes and shards in the cluster. Currently this function has 3 properties:index balance
- balance property over shards per indexshard balance
- balance property over shards per cluster
Each of these properties are expressed as factor such that the properties factor defines the relative importance of the property for the weight function. For example if the weight function should calculate the weights only based on a global (shard) balance the index balance can be set to
The weight per index is calculated based on the following formula:0.0
and will in turn have no effect on the distribution.-
weightindex(node, index) = indexBalance * (node.numShards(index) - avgShardsPerNode(index))
-
weightnode(node, index) = shardBalance * (node.numShards() - avgShardsPerNode)
weight(node, index) = weightindex(node, index) + weightnode(node, index)
-
-
Constructor Summary
Constructors Constructor Description WeightFunction(float indexBalance, float shardBalance)
-
Method Summary
Modifier and Type Method Description float
weight(BalancedShardsAllocator.Balancer balancer, org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ModelNode node, java.lang.String index)
float
weightShardAdded(BalancedShardsAllocator.Balancer balancer, org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ModelNode node, java.lang.String index)
float
weightShardRemoved(BalancedShardsAllocator.Balancer balancer, org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ModelNode node, java.lang.String index)
-
-
-
Method Detail
-
weight
public float weight(BalancedShardsAllocator.Balancer balancer, org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ModelNode node, java.lang.String index)
-
weightShardAdded
public float weightShardAdded(BalancedShardsAllocator.Balancer balancer, org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ModelNode node, java.lang.String index)
-
weightShardRemoved
public float weightShardRemoved(BalancedShardsAllocator.Balancer balancer, org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator.ModelNode node, java.lang.String index)
-
-