From 6db1fd65d385e2365c64e08c18e771eb5b62475f Mon Sep 17 00:00:00 2001 From: Manuel Gutierrez Date: Mon, 21 Oct 2019 16:34:43 +0200 Subject: [PATCH] Add support for environments with low disk space This adds and option to bypass ES default disk-based shard allocation. --- .../ansible-elasticsearch/defaults/main.yml | 1 + .../ansible-elasticsearch/templates/elasticsearch.yml.j2 | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/elastic-stack/ansible-elasticsearch/defaults/main.yml b/roles/elastic-stack/ansible-elasticsearch/defaults/main.yml index c19fcce9..87381a4e 100644 --- a/roles/elastic-stack/ansible-elasticsearch/defaults/main.yml +++ b/roles/elastic-stack/ansible-elasticsearch/defaults/main.yml @@ -14,6 +14,7 @@ elasticsearch_cluster_nodes: elasticsearch_discovery_nodes: - 127.0.0.1 +elasticsearch_lower_disk_requirements: false # X-Pack Security elasticsearch_xpack_security: false elasticsearch_xpack_security_user: elastic diff --git a/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 b/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 index 3cd386da..2bb6ebe4 100644 --- a/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 +++ b/roles/elastic-stack/ansible-elasticsearch/templates/elasticsearch.yml.j2 @@ -27,6 +27,13 @@ discovery.seed_hosts: {% endfor %} {% endif %} +{% if elasticsearch_lower_disk_requirements %} +cluster.routing.allocation.disk.threshold_enabled: true +cluster.routing.allocation.disk.watermark.flood_stage: 200mb +cluster.routing.allocation.disk.watermark.low: 500mb +cluster.routing.allocation.disk.watermark.high: 300mb +{% endif %} + # XPACK Security {% if elasticsearch_xpack_security %} @@ -49,4 +56,4 @@ xpack.security.http.ssl.certificate_authorities: [ "{{ node_certs_destination }} {% elif generate_CA == false %} xpack.security.http.ssl.certificate_authorities: [ "{{ node_certs_destination }}/{{ca_cert_name}}" ] {% endif %} -{% endif %} \ No newline at end of file +{% endif %}