Discovery settings
editDiscovery settings
editElasticsearch uses a custom discovery implementation called "Zen Discovery" for node-to-node clustering and master election. There are two important discovery settings that should be configured before going to production.
discovery.zen.ping.unicast.hosts
editOut of the box, without any network configuration, Elasticsearch will bind to the available loopback addresses and will scan 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 the moment comes to form a cluster with nodes on other servers, you have to provide a seed list of other nodes in the cluster that are likely to be live and contactable. This can be specified as follows:
The port will default to |
|
A hostname that resolves to multiple IP addresses will try all resolved addresses. |
discovery.zen.minimum_master_nodes
editTo prevent data loss, it is vital to configure the
discovery.zen.minimum_master_nodes
setting so that each master-eligible node
knows the minimum number of master-eligible nodes that must be visible in
order to form a cluster.
Without this setting, a cluster that suffers a network failure is at risk of
having the cluster split into two independent clusters — a split brain — which
will lead to data loss. A more detailed explanation is provided in
Avoiding split brain with minimum_master_nodes
.
To avoid a split brain, this setting should be set to a quorum of master-eligible nodes:
(master_eligible_nodes / 2) + 1
In other words, if there are three master-eligible nodes, then minimum master
nodes should be set to (3 / 2) + 1
or 2
:
discovery.zen.minimum_master_nodes: 2