From 3a3f81d59bf1cfe63d625cf7803a2f7f82e78154 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Thu, 15 May 2014 23:17:49 +0200 Subject: [PATCH] Enable DiskThresholdDecider by default, change default limits to 85/90% Fixes #6200 Fixes #6201 --- .../index-modules/allocation.asciidoc | 18 ++++++++++-------- .../decider/DiskThresholdDecider.java | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/reference/index-modules/allocation.asciidoc b/docs/reference/index-modules/allocation.asciidoc index 5f9d082af56..060da487289 100644 --- a/docs/reference/index-modules/allocation.asciidoc +++ b/docs/reference/index-modules/allocation.asciidoc @@ -43,8 +43,8 @@ to be allocated to a node. This is in contrast to `include` which will include a node if ANY rule matches. The `include`, `exclude` and `require` values can have generic simple -matching wildcards, for example, `value1*`. Additonally, special attribute -names called `_ip`, `_name`, `_id` and `_host` can be used to match by node +matching wildcards, for example, `value1*`. Additonally, special attribute +names called `_ip`, `_name`, `_id` and `_host` can be used to match by node ip address, name, id or host name, respectively. Obviously a node can have several attributes associated with it, and @@ -100,16 +100,18 @@ settings API. [[disk]] === Disk-based Shard Allocation +coming[1.3.0] disk based shard allocation is enabled from version 1.3.0 onward + Elasticsearch can be configured to prevent shard allocation on nodes depending on disk usage for the node. This -functionality is disabled by default, and can be changed either in the +functionality is enabled by default, and can be changed either in the configuration file, or dynamically using: [source,js] -------------------------------------------------- curl -XPUT localhost:9200/_cluster/settings -d '{ "transient" : { - "cluster.routing.allocation.disk.threshold_enabled" : true + "cluster.routing.allocation.disk.threshold_enabled" : false } }' -------------------------------------------------- @@ -118,15 +120,15 @@ Once enabled, Elasticsearch uses two watermarks to decide whether shards should be allocated or can remain on the node. `cluster.routing.allocation.disk.watermark.low` controls the low -watermark for disk usage. It defaults to 70%, meaning ES will not -allocate new shards to nodes once they have more than 70% disk +watermark for disk usage. It defaults to 85%, meaning ES will not +allocate new shards to nodes once they have more than 85% disk used. It can also be set to an absolute byte value (like 500mb) to prevent ES from allocating shards if less than the configured amount of space is available. `cluster.routing.allocation.disk.watermark.high` controls the high -watermark. It defaults to 85%, meaning ES will attempt to relocate -shards to another node if the node disk usage rises above 85%. It can +watermark. It defaults to 90%, meaning ES will attempt to relocate +shards to another node if the node disk usage rises above 90%. It can also be set to an absolute byte value (similar to the low watermark) to relocate shards once less than the configured amount of space is available on the node. diff --git a/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java b/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java index c9183692206..4fa9d838f7f 100644 --- a/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java +++ b/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/DiskThresholdDecider.java @@ -110,8 +110,8 @@ public class DiskThresholdDecider extends AllocationDecider { @Inject public DiskThresholdDecider(Settings settings, NodeSettingsService nodeSettingsService) { super(settings); - String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, "70%"); - String highWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, "85%"); + String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK, "85%"); + String highWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_HIGH_DISK_WATERMARK, "90%"); if (!validWatermarkSetting(lowWatermark)) { throw new ElasticsearchParseException("Unable to parse low watermark: [" + lowWatermark + "]"); @@ -126,7 +126,7 @@ public class DiskThresholdDecider extends AllocationDecider { this.freeBytesThresholdLow = thresholdBytesFromWatermark(lowWatermark); this.freeBytesThresholdHigh = thresholdBytesFromWatermark(highWatermark); - this.enabled = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, false); + this.enabled = settings.getAsBoolean(CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED, true); nodeSettingsService.addListener(new ApplySettings()); }