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 |
deprecationLogger, logger, settings
Constructor and Description |
---|
DiskThresholdDecider(Settings settings) |
DiskThresholdDecider(Settings settings,
NodeSettingsService nodeSettingsService,
ClusterInfoService infoService,
Client client) |
Modifier and Type | Method and Description |
---|---|
DiskUsage |
averageUsage(RoutingNode node,
Map<String,DiskUsage> usages)
Returns a
DiskUsage for the RoutingNode using the
average usage of other nodes in the disk usage map. |
Decision |
canAllocate(ShardRouting shardRouting,
RoutingNode node,
RoutingAllocation allocation)
Returns a
Decision whether the given shard routing can be
allocated on the given node. |
Decision |
canRemain(ShardRouting shardRouting,
RoutingNode node,
RoutingAllocation allocation)
Returns a
Decision whether the given shard routing can be remain
on the given node. |
double |
freeDiskPercentageAfterShardAssigned(DiskUsage usage,
Long shardSize)
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() |
ByteSizeValue |
thresholdBytesFromWatermark(String watermark,
String settingName)
Attempts to parse the watermark into a
ByteSizeValue , returning
a ByteSizeValue of 0 bytes if the value cannot be parsed. |
double |
thresholdPercentageFromWatermark(String watermark)
Attempts to parse the watermark into a percentage, returning 100.0% if
it cannot be parsed.
|
boolean |
validWatermarkSetting(String watermark,
String settingName)
Checks if a watermark string is a valid percentage or byte size value,
returning true if valid, false if invalid.
|
canAllocate, canAllocate, canAllocate, canRebalance, canRebalance
logDeprecatedSetting, logRemovedSetting, nodeName
public static final String NAME
public static final String CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED
public static final String CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK
public static final String CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK
public static final String CLUSTER_ROUTING_ALLOCATION_INCLUDE_RELOCATIONS
public static final String CLUSTER_ROUTING_ALLOCATION_REROUTE_INTERVAL
public DiskThresholdDecider(Settings settings)
@Inject public DiskThresholdDecider(Settings settings, NodeSettingsService nodeSettingsService, ClusterInfoService infoService, Client client)
public Double getFreeDiskThresholdLow()
public Double getFreeDiskThresholdHigh()
public Double getUsedDiskThresholdLow()
public Double getUsedDiskThresholdHigh()
public ByteSizeValue getFreeBytesThresholdLow()
public ByteSizeValue getFreeBytesThresholdHigh()
public boolean isIncludeRelocations()
public boolean isEnabled()
public TimeValue getRerouteInterval()
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 canRemain(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
.canRemain
in class AllocationDecider
public DiskUsage averageUsage(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 forusages
- Map of nodeId to DiskUsage for all known nodespublic double freeDiskPercentageAfterShardAssigned(DiskUsage usage, Long shardSize)
usage
- A DiskUsage for the node to have space computed forshardSize
- Size in bytes of the shardpublic double thresholdPercentageFromWatermark(String watermark)
public ByteSizeValue thresholdBytesFromWatermark(String watermark, String settingName)
ByteSizeValue
, returning
a ByteSizeValue of 0 bytes if the value cannot be parsed.Copyright © 2009–2017. All rights reserved.