Class SameShardAllocationDecider
- java.lang.Object
-
- org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
-
- org.elasticsearch.cluster.routing.allocation.decider.SameShardAllocationDecider
-
public class SameShardAllocationDecider extends AllocationDecider
An allocation decider that prevents multiple instances of the same shard to be allocated on the samenode. TheCLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTINGsetting allows to perform a check to prevent allocation of multiple instances of the same shard on a singlehost, based on host name and host address. Defaults to `false`, meaning that no check is performed by default.Note: this setting only applies if multiple nodes are started on the same
host. Allocations of multiple copies of the same shard on the samenodeare not allowed independently of this setting.
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Boolean>CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTINGstatic java.lang.StringNAME
-
Constructor Summary
Constructors Constructor Description SameShardAllocationDecider(Settings settings, ClusterSettings clusterSettings)
-
Method Summary
Modifier and Type Method Description DecisioncanAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)Returns aDecisionwhether the given shard routing can be allocated on the given node.DecisioncanForceAllocatePrimary(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)Returns aDecisionwhether the given primary shard can be forcibly allocated on the given node.-
Methods inherited from class org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
canAllocate, canAllocate, canAllocate, canRebalance, canRebalance, canRemain
-
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING
public static final Setting<java.lang.Boolean> CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING
-
-
Constructor Detail
-
SameShardAllocationDecider
public SameShardAllocationDecider(Settings settings, ClusterSettings clusterSettings)
-
-
Method Detail
-
canAllocate
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
Description copied from class:AllocationDeciderReturns aDecisionwhether the given shard routing can be allocated on the given node. The default isDecision.ALWAYS.- Overrides:
canAllocatein classAllocationDecider
-
canForceAllocatePrimary
public Decision canForceAllocatePrimary(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
Description copied from class:AllocationDeciderReturns aDecisionwhether the given primary shard can be forcibly allocated on the given node. This method should only be called for unassigned primary shards where the node has a shard copy on disk. Note: all implementations that override this behavior should take into account the results ofAllocationDecider.canAllocate(ShardRouting, RoutingNode, RoutingAllocation)before making a decision on force allocation, because force allocation should only be considered if all deciders returnDecision.NO.- Overrides:
canForceAllocatePrimaryin classAllocationDecider
-
-