<commit_before>[[discovery-settings]]
=== Important discovery and cluster formation settings
++++
<titleabbrev>Discovery and cluster formation settings</titleabbrev>
++++

There are two important discovery and cluster formation settings that should be
configured before going to production so that nodes in the cluster can discover
each other and elect a master node.

[discrete]
[[unicast.hosts]]
==== `discovery.seed_hosts`

Out of the box, without any network configuration, Elasticsearch will bind to
the available loopback addresses and will scan local ports 9300 to 9305 to try
to connect to other nodes running on the same server. This provides an
auto-clustering experience without having to do any configuration.

When you want to form a cluster with nodes on other hosts, you should use the
`discovery.seed_hosts` setting to provide a list of other nodes in the cluster
that are master-eligible and likely to be live and contactable in order to seed
the <<modules-discovery-hosts-providers,discovery process>>. This setting
should be a list of the addresses of all the master-eligible nodes in the
cluster. Each address can be either an IP address or a hostname which resolves
to one or more IP addresses via DNS.

If your master-eligible nodes do not have fixed names or addresses, use an
<<built-in-hosts-providers,alternative hosts provider>> to find their addresses
dynamically.

[discrete]
[[initial_master_nodes]]
==== `cluster.initial_master_nodes`

When you start a brand new Elasticsearch cluster for the very first time, there
is a <<modules-discovery-bootstrap-cluster,cluster bootstrapping>> step, which
determines the set of master-eligible nodes whose votes are counted in the very
first election. In <<dev-vs-prod-mode,development mode>>, with no discovery
settings configured, this step is automatically performed by the nodes
themselves. As this auto-bootstrapping is <<modules-discovery-quorums,inherently
unsafe>>, when you start a brand new cluster in <<dev-vs-prod-mode,production
mode>>, you must explicitly list the master-eligible nodes whose votes should be
counted in the very first election. This list is set using the
`cluster.initial_master_nodes` setting. You should not use this setting when
restarting a cluster or adding a new node to an existing cluster.

[source,yaml]
--------------------------------------------------
discovery.seed_hosts:
   - 192.168.1.10:9300
   - 192.168.1.11 <1>
   - seeds.mydomain.com <2>
   - [0:0:0:0:0:ffff:c0a8:10c]:9301 <3>
cluster.initial_master_nodes: <4>
   - master-node-a
   - master-node-b
   - master-node-c
--------------------------------------------------
<1> The port is optional and usually defaults to `9300`, but this default can
    be <<built-in-hosts-providers,overridden>> by certain settings.
<2> If a hostname resolves to multiple IP addresses then the node will attempt to
    discover other nodes at all resolved addresses.
<3> IPv6 addresses must be enclosed in square brackets.
<4> The initial master nodes should be identified by their
    <<node.name,`node.name`>>, which defaults to their hostname. Make sure that
    the value in `cluster.initial_master_nodes` matches the `node.name`
    exactly. If you use a fully-qualified domain name such as<commit_msg>Highlight `cluster.initial_master_nodes` removal after cluster formation (#60631)<commit_after>[[discovery-settings]]
=== Important discovery and cluster formation settings
++++
<titleabbrev>Discovery and cluster formation settings</titleabbrev>
++++

There are two important discovery and cluster formation settings that should be
configured before going to production so that nodes in the cluster can discover
each other and elect a master node.

[discrete]
[[unicast.hosts]]
==== `discovery.seed_hosts`

Out of the box, without any network configuration, Elasticsearch will bind to
the available loopback addresses and will scan local ports 9300 to 9305 to try
to connect to other nodes running on the same server. This provides an
auto-clustering experience without having to do any configuration.

When you want to form a cluster with nodes on other hosts, you should use the
`discovery.seed_hosts` setting to provide a list of other nodes in the cluster
that are master-eligible and likely to be live and contactable in order to seed
the <<modules-discovery-hosts-providers,discovery process>>. This setting
should be a list of the addresses of all the master-eligible nodes in the
cluster. Each address can be either an IP address or a hostname which resolves
to one or more IP addresses via DNS.

If your master-eligible nodes do not have fixed names or addresses, use an
<<built-in-hosts-providers,alternative hosts provider>> to find their addresses
dynamically.

[discrete]
[[initial_master_nodes]]
==== `cluster.initial_master_nodes`

When you start a brand new Elasticsearch cluster for the very first time, there
is a <<modules-discovery-bootstrap-cluster,cluster bootstrapping>> step, which
determines the set of master-eligible nodes whose votes are counted in the very
first election. In <<dev-vs-prod-mode,development mode>>, with no discovery
settings configured, this step is automatically performed by the nodes
themselves. As this auto-bootstrapping is <<modules-discovery-quorums,inherently
unsafe>>, when you start a brand new cluster in <<dev-vs-prod-mode,production
mode>>, you must explicitly list the master-eligible nodes whose votes should be
counted in the very first election. This list is set using the
`cluster.initial_master_nodes` setting. 

NOTE: You should remove `cluster.initial_master_nodes` setting from the nodes' configuration
*once the cluster has successfully formed for the first time*. Do not use this setting when
restarting a cluster or adding a new node to an existing cluster.  

[source,yaml]
--------------------------------------------------
discovery.seed_hosts:
   - 192.168.1.10:9300
   - 192.168.1.11 <1>
   - seeds.mydomain.com <2>
   - [0:0:0:0:0:ffff:c0a8:10c]:9301 <3>
cluster.initial_master_nodes: <4>
   - master-node-a
   - master-node-b
   - master-node-c
--------------------------------------------------
<1> The port is optional and usually defaults to `9300`, but this default can
    be <<built-in-hosts-providers,overridden>> by certain settings.
<2> If a hostname resolves to multiple IP addresses then the node will attempt to
    discover other nodes at all resolved addresses.
<3> IPv6 addresses must be enclosed in square brackets.
<4> The initial master nodes should be identified by their
    <<node.name,`node.name`>>, which defaults to their hostname. Make sure that
    the value in `cluster.initial_master_nodes` matches the `node.name`
    exactly. If you use a fully-qualified domain name such as
{'fraction_non_alphanumeric': 0.09727164887307237, 'fraction_numerical': 0.017348754448398576, 'mean_word_length': 4.029828486204325, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3316181', 'n_tokens_mistral': 1842, 'n_tokens_neox': 1725, 'n_words': 850}