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.
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 must 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 discovery process. 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
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
When you start a brand new Elasticsearch cluster for the very first time, there
is a cluster bootstrapping step, which
determines the set of master-eligible nodes whose votes are counted in the very
first election. In development mode, with no discovery
settings configured, this step is automatically performed by the nodes
themselves. As this auto-bootstrapping is inherently unsafe, when you start a brand new cluster in 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
The port will default to
If a hostname resolves to multiple IP addresses then the node will attempt to discover other nodes at all resolved addresses.
Initial master nodes can be identified by their
Initial master nodes can also be identified by their IP address.
If multiple master nodes share an IP address then the transport port must be used to distinguish between them.