Module org.elasticsearch.server
Class DiskThresholdDecider
java.lang.Object
org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
org.elasticsearch.cluster.routing.allocation.decider.DiskThresholdDecider
The
DiskThresholdDecider
checks that the node a shard is potentially
being allocated to has enough disk space.
It has the following configurable settings, all of which can be changed dynamically:
cluster.routing.allocation.disk.watermark.low
is the low disk
watermark. New shards will not allocated to a node with usage higher than this,
although this watermark may be passed by allocating a shard. It defaults to
0.85 (85.0%).
cluster.routing.allocation.disk.watermark.low.max_headroom
is the
max headroom for the low watermark. Defaults to 200GB when the low watermark
is not explicitly set. This caps the amount of free space required.
cluster.routing.allocation.disk.watermark.high
is the high disk
watermark. If a node has usage higher than this, shards are not allowed to
remain on the node. In addition, if allocating a shard to a node causes the
node to pass this watermark, it will not be allowed. It defaults to
0.90 (90.0%).
cluster.routing.allocation.disk.watermark.high.max_headroom
is the
max headroom for the high watermark. Defaults to 150GB when the high watermark
is not explicitly set. This caps the amount of free space required.
The watermark settings are expressed in terms of used disk percentage/ratio, or
exact byte values for free space (like "500mb").
cluster.routing.allocation.disk.threshold_enabled
is used to
enable or disable this decider. It defaults to true (enabled).-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncanAllocate
(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given shard routing can be allocated on the given node.canForceAllocateDuringReplace
(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given shard can be forced to the given node in the event that the shard's source node is being replaced.canRemain
(IndexMetadata indexMetadata, ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Returns aDecision
whether the given shard routing can be remain on the given node.static long
getExpectedShardSize
(ShardRouting shard, long defaultValue, ClusterInfo clusterInfo, SnapshotShardSizeInfo snapshotShardSizeInfo, Metadata metadata, RoutingTable routingTable) Returns the expected shard size for the given shard or the default value provided if not enough information are available to estimate the shards size.static long
sizeOfUnaccountedShards
(RoutingNode node, boolean subtractShardsMovingAway, String dataPath, ClusterInfo clusterInfo, Metadata metadata, RoutingTable routingTable, long sizeOfUnaccountableSearchableSnapshotShards) Returns the size of all unaccounted shards that are currently being relocated to the node, but may not be finished transferring yet.Methods inherited from class org.elasticsearch.cluster.routing.allocation.decider.AllocationDecider
canAllocate, canAllocate, canAllocateReplicaWhenThereIsRetentionLease, canForceAllocatePrimary, canRebalance, canRebalance, shouldAutoExpandToNode
-
Field Details
-
NAME
- See Also:
-
ENABLE_FOR_SINGLE_DATA_NODE
-
SETTING_IGNORE_DISK_WATERMARKS
-
-
Constructor Details
-
DiskThresholdDecider
-
-
Method Details
-
sizeOfUnaccountedShards
public static long sizeOfUnaccountedShards(RoutingNode node, boolean subtractShardsMovingAway, String dataPath, ClusterInfo clusterInfo, Metadata metadata, RoutingTable routingTable, long sizeOfUnaccountableSearchableSnapshotShards) Returns the size of all unaccounted shards that are currently being relocated to the node, but may not be finished transferring yet. Also accounts for started searchable snapshot shards that have been allocated, but not present in the stale cluster info. If subtractShardsMovingAway is true then the size of shards moving away is subtracted from the total size of all shards -
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
-
canForceAllocateDuringReplace
public Decision canForceAllocateDuringReplace(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation) Description copied from class:AllocationDecider
Returns aDecision
whether the given shard can be forced to the given node in the event that the shard's source node is being replaced. This allows nodes using a replace-type node shutdown to override certain deciders in the interest of moving the shard away from a node that *must* be removed. It defaults to returning "YES" and must be overridden by deciders that opt-out to having their other NO decisions *not* overridden while vacating. The caller is responsible for first checking: - that a replacement is ongoing - the shard routing's current node is the source of the replacement- Overrides:
canForceAllocateDuringReplace
in classAllocationDecider
-
canRemain
public Decision canRemain(IndexMetadata indexMetadata, 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
-
getExpectedShardSize
public static long getExpectedShardSize(ShardRouting shard, long defaultValue, ClusterInfo clusterInfo, SnapshotShardSizeInfo snapshotShardSizeInfo, Metadata metadata, RoutingTable routingTable) Returns the expected shard size for the given shard or the default value provided if not enough information are available to estimate the shards size.
-