Class ShardsLimitAllocationDecider
- java.lang.Object
-
- org.elasticsearch.common.component.AbstractComponent
-
- org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
-
- org.elasticsearch.cluster.routing.allocation.decider.ShardsLimitAllocationDecider
-
public class ShardsLimitAllocationDecider extends AllocationDecider
ThisAllocationDecider
limits the number of shards per node on a per index or node-wide basis. The allocator prevents a single node to hold more thanindex.routing.allocation.total_shards_per_node
per index andcluster.routing.allocation.total_shards_per_node
globally during the allocation process. The limits of this decider can be changed in real-time via a the index settings API.If
index.routing.allocation.total_shards_per_node
is reset to a negative value shards per index are unlimited per node. Shards currently in therelocating
state are ignored by thisAllocationDecider
until the shard changed its state to eitherstarted
,inializing
orunassigned
Note: Reducing the number of shards per node via the index update API can trigger relocation and significant additional load on the clusters nodes.
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Integer>
CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING
Controls the maximum number of shards per node on a global level.static Setting<java.lang.Integer>
INDEX_TOTAL_SHARDS_PER_NODE_SETTING
Controls the maximum number of shards per index on a single Elasticsearch node.static java.lang.String
NAME
-
Fields inherited from class org.elasticsearch.common.component.AbstractComponent
deprecationLogger, logger, settings
-
-
Constructor Summary
Constructors Constructor Description ShardsLimitAllocationDecider(Settings settings, ClusterSettings clusterSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Decision
canAllocate(RoutingNode node, RoutingAllocation allocation)
Returns aDecision
whether the given node can allow any allocation at all at this state of theRoutingAllocation
.Decision
canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
Returns aDecision
whether the given shard routing can be allocated on the given node.Decision
canRemain(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
Returns aDecision
whether the given shard routing can be remain on the given node.-
Methods inherited from class org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
canAllocate, canAllocate, canForceAllocatePrimary, canRebalance, canRebalance
-
Methods inherited from class org.elasticsearch.common.component.AbstractComponent
nodeName
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
INDEX_TOTAL_SHARDS_PER_NODE_SETTING
public static final Setting<java.lang.Integer> INDEX_TOTAL_SHARDS_PER_NODE_SETTING
Controls the maximum number of shards per index on a single Elasticsearch node. Negative values are interpreted as unlimited.
-
CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING
public static final Setting<java.lang.Integer> CLUSTER_TOTAL_SHARDS_PER_NODE_SETTING
Controls the maximum number of shards per node on a global level. Negative values are interpreted as unlimited.
-
-
Constructor Detail
-
ShardsLimitAllocationDecider
public ShardsLimitAllocationDecider(Settings settings, ClusterSettings clusterSettings)
-
-
Method Detail
-
canAllocate
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
Description copied from class:AllocationDecider
Returns aDecision
whether the given shard routing can be allocated on the given node. The default isDecision.ALWAYS
.- Overrides:
canAllocate
in classAllocationDecider
-
canRemain
public Decision canRemain(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
Description copied from class:AllocationDecider
Returns aDecision
whether the given shard routing can be remain on the given node. The default isDecision.ALWAYS
.- Overrides:
canRemain
in classAllocationDecider
-
canAllocate
public Decision canAllocate(RoutingNode node, RoutingAllocation allocation)
Description copied from class:AllocationDecider
Returns aDecision
whether the given node can allow any allocation at all at this state of theRoutingAllocation
. The default isDecision.ALWAYS
.- Overrides:
canAllocate
in classAllocationDecider
-
-