2017-12-12 10:24:37 -05:00
|
|
|
[[discovery-settings]]
|
2018-12-21 14:24:48 -05:00
|
|
|
=== Important discovery and cluster formation settings
|
|
|
|
++++
|
|
|
|
<titleabbrev>Discovery and cluster formation settings</titleabbrev>
|
|
|
|
++++
|
2017-12-12 10:24:37 -05:00
|
|
|
|
2018-12-20 08:02:44 -05:00
|
|
|
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.
|
2017-12-12 10:24:37 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2017-12-12 10:24:37 -05:00
|
|
|
[[unicast.hosts]]
|
2019-02-05 03:46:52 -05:00
|
|
|
==== `discovery.seed_hosts`
|
2017-12-12 10:24:37 -05:00
|
|
|
|
|
|
|
Out of the box, without any network configuration, Elasticsearch will bind to
|
2018-12-20 08:02:44 -05:00
|
|
|
the available loopback addresses and will scan local ports 9300 to 9305 to try
|
2020-02-27 03:51:17 -05:00
|
|
|
to connect to other nodes running on the same server. This provides an
|
|
|
|
auto-clustering experience without having to do any configuration.
|
2017-12-12 10:24:37 -05:00
|
|
|
|
2020-02-27 03:51:17 -05:00
|
|
|
When you want to form a cluster with nodes on other hosts, you should use the
|
2019-02-06 06:34:38 -05:00
|
|
|
`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
|
2020-02-27 03:51:17 -05:00
|
|
|
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.
|
2019-02-06 06:34:38 -05:00
|
|
|
|
2020-07-23 12:42:33 -04:00
|
|
|
[discrete]
|
2018-12-20 08:02:44 -05:00
|
|
|
[[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
|
2019-07-01 07:39:12 -04:00
|
|
|
mode>>, you must explicitly list the master-eligible nodes whose votes should be
|
2019-10-10 04:53:27 -04:00
|
|
|
counted in the very first election. This list is set using the
|
2020-08-05 03:57:57 -04:00
|
|
|
`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.
|
2017-12-12 10:24:37 -05:00
|
|
|
|
|
|
|
[source,yaml]
|
|
|
|
--------------------------------------------------
|
2019-02-05 03:46:52 -05:00
|
|
|
discovery.seed_hosts:
|
2017-12-12 10:24:37 -05:00
|
|
|
- 192.168.1.10:9300
|
|
|
|
- 192.168.1.11 <1>
|
|
|
|
- seeds.mydomain.com <2>
|
2020-02-27 03:51:17 -05:00
|
|
|
- [0:0:0:0:0:ffff:c0a8:10c]:9301 <3>
|
|
|
|
cluster.initial_master_nodes: <4>
|
2019-05-08 05:23:55 -04:00
|
|
|
- master-node-a
|
|
|
|
- master-node-b
|
|
|
|
- master-node-c
|
2017-12-12 10:24:37 -05:00
|
|
|
--------------------------------------------------
|
2020-02-27 03:51:17 -05:00
|
|
|
<1> The port is optional and usually defaults to `9300`, but this default can
|
|
|
|
be <<built-in-hosts-providers,overridden>> by certain settings.
|
2018-12-20 08:02:44 -05:00
|
|
|
<2> If a hostname resolves to multiple IP addresses then the node will attempt to
|
|
|
|
discover other nodes at all resolved addresses.
|
2020-02-27 03:51:17 -05:00
|
|
|
<3> IPv6 addresses must be enclosed in square brackets.
|
|
|
|
<4> The initial master nodes should be identified by their
|
2019-05-08 05:23:55 -04:00
|
|
|
<<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
|
|
|
|
`master-node-a.example.com` for your node names then you must use the
|
|
|
|
fully-qualified name in this list; conversely if `node.name` is a bare
|
|
|
|
hostname without any trailing qualifiers then you must also omit the
|
|
|
|
trailing qualifiers in `cluster.initial_master_nodes`.
|
2018-12-21 14:24:48 -05:00
|
|
|
|
2019-04-14 05:39:50 -04:00
|
|
|
For more information, see <<modules-discovery-bootstrap-cluster>> and
|
|
|
|
<<modules-discovery-settings>>.
|