public class SameShardAllocationDecider extends AllocationDecider
CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING
setting allows to perform a check to prevent
allocation of multiple instances of the same shard on a single host,
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 same node are not allowed independently of this setting.
Modifier and Type | Field and Description |
---|---|
static Setting<java.lang.Boolean> |
CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING |
static java.lang.String |
NAME |
deprecationLogger, logger, settings
Constructor and Description |
---|
SameShardAllocationDecider(Settings settings,
ClusterSettings clusterSettings) |
Modifier and Type | Method and Description |
---|---|
Decision |
canAllocate(ShardRouting shardRouting,
RoutingNode node,
RoutingAllocation allocation)
Returns a
Decision whether the given shard routing can be
allocated on the given node. |
Decision |
canForceAllocatePrimary(ShardRouting shardRouting,
RoutingNode node,
RoutingAllocation allocation)
Returns a
Decision whether the given primary shard can be
forcibly allocated on the given node. |
canAllocate, canAllocate, canAllocate, canRebalance, canRebalance, canRemain
logDeprecatedSetting, logRemovedSetting, nodeName
public static final java.lang.String NAME
public static final Setting<java.lang.Boolean> CLUSTER_ROUTING_ALLOCATION_SAME_HOST_SETTING
public SameShardAllocationDecider(Settings settings, ClusterSettings clusterSettings)
public Decision canAllocate(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
AllocationDecider
Decision
whether the given shard routing can be
allocated on the given node. The default is Decision.ALWAYS
.canAllocate
in class AllocationDecider
public Decision canForceAllocatePrimary(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
AllocationDecider
Decision
whether 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 of AllocationDecider.canAllocate(ShardRouting, RoutingNode, RoutingAllocation)
before making a decision on force allocation, because force allocation should only
be considered if all deciders return Decision.NO
.canForceAllocatePrimary
in class AllocationDecider