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
|
|
|
|
|
|
|
[float]
|
|
|
|
[[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
|
|
|
|
to connect to other nodes running on the same server. This provides an auto-
|
2017-12-12 10:24:37 -05:00
|
|
|
clustering experience without having to do any configuration.
|
|
|
|
|
2018-12-20 08:02:44 -05:00
|
|
|
When the moment comes to form a cluster with nodes on other servers, you must
|
2019-02-05 03:46:52 -05:00
|
|
|
use the `discovery.seed_hosts` setting to provide a seed list of
|
2018-12-20 08:02:44 -05:00
|
|
|
other nodes in the cluster that are master-eligible and likely to be live and
|
|
|
|
contactable. This setting should normally contain the addresses of all the
|
|
|
|
master-eligible nodes in the cluster.
|
|
|
|
This setting contains either an array of hosts or a comma-delimited string. Each
|
|
|
|
value should be in the form of `host:port` or `host` (where `port` defaults to
|
|
|
|
the setting `transport.profiles.default.port` falling back to `transport.port`
|
|
|
|
if not set). Note that IPv6 hosts must be bracketed. The default for this
|
|
|
|
setting is `127.0.0.1, [::1]`
|
|
|
|
[float]
|
|
|
|
[[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 names or IP addresses of 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.
|
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>
|
2018-12-20 08:02:44 -05:00
|
|
|
cluster.initial_master_nodes:
|
|
|
|
- master-node-a <3>
|
|
|
|
- 192.168.1.12 <4>
|
|
|
|
- 192.168.1.13:9301 <5>
|
2017-12-12 10:24:37 -05:00
|
|
|
--------------------------------------------------
|
|
|
|
<1> The port will default to `transport.profiles.default.port` and fallback to
|
2018-12-18 15:09:58 -05:00
|
|
|
`transport.port` if not specified.
|
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.
|
|
|
|
<3> Initial master nodes can be identified by their <<node.name,node name>>.
|
|
|
|
<4> Initial master nodes can also be identified by their IP address.
|
|
|
|
<5> If multiple master nodes share an IP address then the port must be used to
|
|
|
|
disambiguate them.
|
2018-12-21 14:24:48 -05:00
|
|
|
|
2019-02-05 03:46:52 -05:00
|
|
|
For more information, see <<modules-discovery-settings>>.
|