discovery-settings.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. [[discovery-settings]]
  2. === Important discovery and cluster formation settings
  3. ++++
  4. <titleabbrev>Discovery and cluster formation settings</titleabbrev>
  5. ++++
  6. There are two important discovery and cluster formation settings that should be
  7. configured before going to production so that nodes in the cluster can discover
  8. each other and elect a master node.
  9. [float]
  10. [[unicast.hosts]]
  11. ==== `discovery.seed_hosts`
  12. Out of the box, without any network configuration, Elasticsearch will bind to
  13. the available loopback addresses and will scan local ports 9300 to 9305 to try
  14. to connect to other nodes running on the same server. This provides an auto-
  15. clustering experience without having to do any configuration.
  16. When you want to form a cluster with nodes on other hosts, you must use the
  17. `discovery.seed_hosts` setting to provide a list of other nodes in the cluster
  18. that are master-eligible and likely to be live and contactable in order to seed
  19. the <<modules-discovery-hosts-providers,discovery process>>. This setting
  20. should normally contain the addresses of all the master-eligible nodes in the
  21. cluster. This setting contains either an array of hosts or a comma-delimited
  22. string. Each value should be in the form of `host:port` or `host` (where `port`
  23. defaults to the setting `transport.profiles.default.port` falling back to
  24. `transport.port` if not set). Note that IPv6 hosts must be bracketed. The
  25. default for this setting is `127.0.0.1, [::1]`.
  26. [float]
  27. [[initial_master_nodes]]
  28. ==== `cluster.initial_master_nodes`
  29. When you start a brand new Elasticsearch cluster for the very first time, there
  30. is a <<modules-discovery-bootstrap-cluster,cluster bootstrapping>> step, which
  31. determines the set of master-eligible nodes whose votes are counted in the very
  32. first election. In <<dev-vs-prod-mode,development mode>>, with no discovery
  33. settings configured, this step is automatically performed by the nodes
  34. themselves. As this auto-bootstrapping is <<modules-discovery-quorums,inherently
  35. unsafe>>, when you start a brand new cluster in <<dev-vs-prod-mode,production
  36. mode>>, you must explicitly list the names or IP addresses of the
  37. master-eligible nodes whose votes should be counted in the very first election.
  38. This list is set using the `cluster.initial_master_nodes` setting.
  39. [source,yaml]
  40. --------------------------------------------------
  41. discovery.seed_hosts:
  42. - 192.168.1.10:9300
  43. - 192.168.1.11 <1>
  44. - seeds.mydomain.com <2>
  45. cluster.initial_master_nodes:
  46. - master-node-a <3>
  47. - 192.168.1.12 <4>
  48. - 192.168.1.13:9301 <5>
  49. --------------------------------------------------
  50. <1> The port will default to `transport.profiles.default.port` and fallback to
  51. `transport.port` if not specified.
  52. <2> If a hostname resolves to multiple IP addresses then the node will attempt to
  53. discover other nodes at all resolved addresses.
  54. <3> Initial master nodes can be identified by their <<node.name,node name>>.
  55. <4> Initial master nodes can also be identified by their IP address.
  56. <5> If multiple master nodes share an IP address then the port must be used to
  57. disambiguate them.
  58. For more information, see <<modules-discovery-settings>>.