Skip to content

Commit b6855b3

Browse files
authored
Only set discovery seed hosts if greater than 1 (revisited) (#92)
Use "discovery.type: single-node" instead of "discovery.seed_hosts" with single-node clusters.
1 parent 0960480 commit b6855b3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cars/v1/vanilla/templates/config/elasticsearch.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,17 @@ transport.port: {{transport_port}}
6868
# Pass an initial list of hosts to perform discovery when this node is started:
6969
# The default list of hosts is ["127.0.0.1", "[::1]"]
7070
#
71-
{%- if all_node_ips %}
71+
{%- if all_node_ips|length > 4 %}
72+
{%- if all_node_ips_count|default(2) > 1 %}
7273
discovery.seed_hosts: {{ all_node_ips }}
7374
# Prevent split brain by specifying the initial master nodes.
74-
{%- if all_node_names is defined %}
75+
{%- if all_node_names is defined %}
7576
cluster.initial_master_nodes: {{ all_node_names }}
76-
{%- else %}
77+
{%- else %}
7778
cluster.initial_master_nodes: {{ all_node_ips }}
79+
{%- endif %}
80+
{%- else %}
81+
discovery.type: single-node
7882
{%- endif %}
7983
{%- else %}
8084
#discovery.seed_hosts: ["host1", "host2"]

0 commit comments

Comments
 (0)