From 362ba75e6b6f3d787289bd2d5ce28203a7a6c63c Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Wed, 20 Dec 2017 17:23:36 -0500 Subject: [PATCH 1/2] [ML] Use auto_expand_replicas (elastic/x-pack-elasticsearch#3375) This creates all ML templates using the `index.auto_expand_replicas` set as `"0-1"` so that a single node cluster (e.g., dev) can startup as green. Original commit: elastic/x-pack-elasticsearch@7a243c5b066aee610d3cbd5131b7a588628c6653 --- .../main/java/org/elasticsearch/xpack/ml/MachineLearning.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index dc506c49d70..7ab45bbc8f4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -576,6 +576,7 @@ public class MachineLearning implements ActionPlugin { // Our indexes are small and one shard puts the // least possible burden on Elasticsearch .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-1") .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting)) .build(); templates.put(Auditor.NOTIFICATIONS_INDEX, notificationMessageTemplate); @@ -590,6 +591,7 @@ public class MachineLearning implements ActionPlugin { // Our indexes are small and one shard puts the // least possible burden on Elasticsearch .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-1") .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting)) .version(Version.CURRENT.id) .putMapping(MlMetaIndex.TYPE, docMapping.string()) @@ -604,6 +606,7 @@ public class MachineLearning implements ActionPlugin { .patterns(Collections.singletonList(AnomalyDetectorsIndex.jobStateIndexName())) // TODO review these settings .settings(Settings.builder() + .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-1") .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting) // Sacrifice durability for performance: in the event of power // failure we can lose the last 5 seconds of changes, but it's @@ -621,6 +624,7 @@ public class MachineLearning implements ActionPlugin { IndexTemplateMetaData jobResultsTemplate = IndexTemplateMetaData.builder(AnomalyDetectorsIndex.jobResultsIndexPrefix()) .patterns(Collections.singletonList(AnomalyDetectorsIndex.jobResultsIndexPrefix() + "*")) .settings(Settings.builder() + .put(IndexMetaData.SETTING_AUTO_EXPAND_REPLICAS, "0-1") .put(UnassignedInfo.INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.getKey(), delayedNodeTimeOutSetting) // Sacrifice durability for performance: in the event of power // failure we can lose the last 5 seconds of changes, but it's From 2507a07ec9540efc994df5428710f289bceded05 Mon Sep 17 00:00:00 2001 From: Chris Earle Date: Wed, 20 Dec 2017 17:25:04 -0500 Subject: [PATCH 2/2] [Watcher] Use auto_expand_replicas on triggered_watches index too (elastic/x-pack-elasticsearch#3371) In the previous pass, only the ".watch*" templates were impacted. This also should use `auto_expand_replicas`. Original commit: elastic/x-pack-elasticsearch@5d3a4f1f7bc3eed16a0d3517aafdf9b4fb6c0f90 --- plugin/src/main/resources/triggered-watches.json | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/src/main/resources/triggered-watches.json b/plugin/src/main/resources/triggered-watches.json index 3c89d83a69e..fb345260008 100644 --- a/plugin/src/main/resources/triggered-watches.json +++ b/plugin/src/main/resources/triggered-watches.json @@ -3,6 +3,7 @@ "order": 2147483647, "settings": { "index.number_of_shards": 1, + "index.auto_expand_replicas": "0-1", "index.refresh_interval" : "-1", "index.format": 6, "index.priority": 900