public class DiskThresholdDecider extends AllocationDecider
DiskThresholdDecider checks that the node a shard is potentially being allocated to has enough disk space. It has three 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.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%). Both watermark settings are expressed in terms of used disk percentage, 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 false (disabled).
| Modifier and Type | Field and Description |
|---|---|
static String |
CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED
|
static String |
CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK
|
static String |
CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS
|
static String |
CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK
|
static String |
CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL
|
static String |
NAME
|
componentSettings, logger, settings| Constructor and Description |
|---|
DiskThresholdDecider(Settings
|
DiskThresholdDecider(Settings
|
| Modifier and Type | Method and Description |
|---|---|
DiskUsage |
averageUsage(RoutingNode
Returns a
DiskUsage for the
RoutingNode using the average usage of other nodes in the disk usage map.
|
Decision |
canAllocate(ShardRouting
Returns a
Decision whether the given shard routing can be allocated on the given node.
|
Decision |
canRemain(ShardRouting
Returns a
Decision whether the given shard routing can be remain on the given node.
|
double |
freeDiskPercentageAfterShardAssigned(DiskUsage
Given the DiskUsage for a node and the size of the shard, return the percentage of free disk if the shard were to be allocated to the node.
|
ByteSizeValue |
getFreeBytesThresholdHigh()
|
ByteSizeValue |
getFreeBytesThresholdLow()
|
Double |
getFreeDiskThresholdHigh()
|
Double |
getFreeDiskThresholdLow()
|
TimeValue |
getRerouteInterval()
|
Double |
getUsedDiskThresholdHigh()
|
Double |
getUsedDiskThresholdLow()
|
boolean |
isEnabled()
|
boolean |
isIncludeRelocations()
|
long |
sizeOfRelocatingShards(RoutingNode
Returns the size of all shards that are currently being relocated to the node, but may not be finished transfering yet.
|
ByteSizeValue |
thresholdBytesFromWatermark(String
Attempts to parse the watermark into a
ByteSizeValue, returning a ByteSizeValue of 0 bytes if the value cannot be parsed.
|
double |
thresholdPercentageFromWatermark(String
Attempts to parse the watermark into a percentage, returning 100.0% if it cannot be parsed.
|
boolean |
validWatermarkSetting(String
Checks if a watermark string is a valid percentage or byte size value, returning true if valid, false if invalid.
|
canAllocate, canAllocate, canRebalance, canRebalancenodeNamepublic static final StringNAME
public static final StringCLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED
public static final StringCLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK
public static final StringCLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK
public static final StringCLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS
public static final StringCLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL
public DiskThresholdDecider(Settingssettings)
@Inject public DiskThresholdDecider(Settingssettings, NodeSettingsService nodeSettingsService, ClusterInfoService infoService, Client client)
public DoublegetFreeDiskThresholdLow()
public DoublegetFreeDiskThresholdHigh()
public DoublegetUsedDiskThresholdLow()
public DoublegetUsedDiskThresholdHigh()
public ByteSizeValuegetFreeBytesThresholdLow()
public ByteSizeValuegetFreeBytesThresholdHigh()
public boolean isIncludeRelocations()
public boolean isEnabled()
public TimeValuegetRerouteInterval()
public long sizeOfRelocatingShards(RoutingNodenode, Map <String ,Long > shardSizes, boolean subtractShardsMovingAway)
public DecisioncanAllocate(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 .
public DecisioncanRemain(ShardRouting shardRouting, RoutingNode node, RoutingAllocation allocation)
AllocationDecider
Decision whether the given shard routing can be remain on the given node. The default is
Decision.ALWAYS .
public DiskUsageaverageUsage(RoutingNode node, Map <String ,DiskUsage > usages)
DiskUsage for the
RoutingNode using the average usage of other nodes in the disk usage map.
node - Node to return an averaged DiskUsage object for
usages - Map of nodeId to DiskUsage for all known nodes
public double freeDiskPercentageAfterShardAssigned(DiskUsageusage, Long shardSize)
usage - A DiskUsage for the node to have space computed for
shardSize - Size in bytes of the shard
public double thresholdPercentageFromWatermark(Stringwatermark)
public ByteSizeValuethresholdBytesFromWatermark(String watermark)
ByteSizeValue, returning a ByteSizeValue of 0 bytes if the value cannot be parsed.
public boolean validWatermarkSetting(Stringwatermark)