discovery-settings.asciidoc 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. [[discovery-settings]]
  2. === Discovery settings
  3. Elasticsearch uses a custom discovery implementation called "Zen Discovery" for
  4. node-to-node clustering and master election. There are two important discovery
  5. settings that should be configured before going to production.
  6. [float]
  7. [[unicast.hosts]]
  8. ==== `discovery.zen.ping.unicast.hosts`
  9. Out of the box, without any network configuration, Elasticsearch will bind to
  10. the available loopback addresses and will scan ports 9300 to 9305 to try to
  11. connect to other nodes running on the same server. This provides an auto-
  12. clustering experience without having to do any configuration.
  13. When the moment comes to form a cluster with nodes on other servers, you have to
  14. provide a seed list of other nodes in the cluster that are likely to be live and
  15. contactable. This can be specified as follows:
  16. [source,yaml]
  17. --------------------------------------------------
  18. discovery.zen.ping.unicast.hosts:
  19. - 192.168.1.10:9300
  20. - 192.168.1.11 <1>
  21. - seeds.mydomain.com <2>
  22. --------------------------------------------------
  23. <1> The port will default to `transport.profiles.default.port` and fallback to
  24. `transport.tcp.port` if not specified.
  25. <2> A hostname that resolves to multiple IP addresses will try all resolved
  26. addresses.
  27. [float]
  28. [[minimum_master_nodes]]
  29. ==== `discovery.zen.minimum_master_nodes`
  30. To prevent data loss, it is vital to configure the
  31. `discovery.zen.minimum_master_nodes` setting so that each master-eligible node
  32. knows the _minimum number of master-eligible nodes_ that must be visible in
  33. order to form a cluster.
  34. Without this setting, a cluster that suffers a network failure is at risk of
  35. having the cluster split into two independent clusters -- a split brain -- which
  36. will lead to data loss. A more detailed explanation is provided in
  37. <<split-brain>>.
  38. To avoid a split brain, this setting should be set to a _quorum_ of
  39. master-eligible nodes:
  40. (master_eligible_nodes / 2) + 1
  41. In other words, if there are three master-eligible nodes, then minimum master
  42. nodes should be set to `(3 / 2) + 1` or `2`:
  43. [source,yaml]
  44. --------------------------------------------------
  45. discovery.zen.minimum_master_nodes: 2
  46. --------------------------------------------------