Add more optionality when customizing node roles
The node roles would apply attributes to hosts if an override was set or if a node was part of a given group as determined through auto-detection. This change will now add nodes to a given role when set manually and will ensure no extra nodes are added to the role if the count meets or exceeds what's required to run the service. Change-Id: Ied5f564f0328488d3359ec4dc8e9ad17fefe5eaf Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
10ffc96ab1
commit
1f9171082e
@ -47,8 +47,13 @@ data_nodes: |-
|
||||
{% for node in groups['elastic-logstash'] %}
|
||||
{% if (hostvars[node]['elasticsearch_node_data'] is defined) and (hostvars[node]['elasticsearch_node_data'] | bool) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% elif (node in _data_nodes) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for node in groups['elastic-logstash'] %}
|
||||
{% if (nodes | length) <= (_data_nodes | length) %}
|
||||
{% if (node in _data_nodes) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ nodes }}
|
||||
@ -62,8 +67,13 @@ logstash_nodes: |-
|
||||
{% for node in groups['elastic-logstash'] %}
|
||||
{% if (hostvars[node]['elasticsearch_node_ingest'] is defined) and (hostvars[node]['elasticsearch_node_ingest'] | bool) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% elif (node in _logstash_nodes) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for node in groups['elastic-logstash'] %}
|
||||
{% if (nodes | length) <= (_logstash_nodes | length) %}
|
||||
{% if (node in _logstash_nodes) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ nodes }}
|
||||
@ -77,8 +87,13 @@ ingest_nodes: |-
|
||||
{% for node in groups['elastic-logstash'] %}
|
||||
{% if (hostvars[node]['elasticsearch_node_ingest'] is defined) and (hostvars[node]['elasticsearch_node_ingest'] | bool) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% elif (node in _ingest_nodes) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for node in groups['elastic-logstash'] %}
|
||||
{% if (nodes | length) <= (_ingest_nodes | length) %}
|
||||
{% if (node in _ingest_nodes) %}
|
||||
{% set _ = nodes.append(node) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{{ nodes }}
|
||||
|
@ -64,7 +64,7 @@ http.port: {{ elastic_port }}
|
||||
#<https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-node.html>
|
||||
discovery.zen.ping.unicast.hosts: {{ zen_nodes | to_json }}
|
||||
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
|
||||
discovery.zen.minimum_master_nodes: {{ ((master_node_count | int) // 2) + 1 }}
|
||||
discovery.zen.minimum_master_nodes: {{ elasticsearch_master_node_count | default(((master_node_count | int) // 2) + 1) }}
|
||||
# The first set of nodes in the master_node_count are marked as such
|
||||
node.master: {{ elasticsearch_node_master | default(master_node) }}
|
||||
# Every node in the master list and every other node after will be a data node
|
||||
@ -91,7 +91,7 @@ search.remote.connect: {{ data_node }}
|
||||
#
|
||||
# Block initial recovery after a full cluster restart until N nodes are started:
|
||||
#
|
||||
gateway.recover_after_nodes: {{ ((master_node_count | int) // 2) + 1 }}
|
||||
gateway.recover_after_nodes: {{ elasticsearch_master_node_count | default(((master_node_count | int) // 2) + 1) }}
|
||||
#
|
||||
# For more information, see the documentation at:
|
||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
|
||||
|
Loading…
Reference in New Issue
Block a user