discovery-settings.asciidoc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. [discrete]
  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
  15. auto-clustering experience without having to do any configuration.
  16. When you want to form a cluster with nodes on other hosts, you should 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 be a list of the addresses of all the master-eligible nodes in the
  21. cluster. Each address can be either an IP address or a hostname which resolves
  22. to one or more IP addresses via DNS.
  23. If your master-eligible nodes do not have fixed names or addresses, use an
  24. <<built-in-hosts-providers,alternative hosts provider>> to find their addresses
  25. dynamically.
  26. [discrete]
  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 master-eligible nodes whose votes should be
  37. counted in the very first election. This list is set using the
  38. `cluster.initial_master_nodes` setting. You should not use this setting when
  39. restarting a cluster or adding a new node to an existing cluster.
  40. [source,yaml]
  41. --------------------------------------------------
  42. discovery.seed_hosts:
  43. - 192.168.1.10:9300
  44. - 192.168.1.11 <1>
  45. - seeds.mydomain.com <2>
  46. - [0:0:0:0:0:ffff:c0a8:10c]:9301 <3>
  47. cluster.initial_master_nodes: <4>
  48. - master-node-a
  49. - master-node-b
  50. - master-node-c
  51. --------------------------------------------------
  52. <1> The port is optional and usually defaults to `9300`, but this default can
  53. be <<built-in-hosts-providers,overridden>> by certain settings.
  54. <2> If a hostname resolves to multiple IP addresses then the node will attempt to
  55. discover other nodes at all resolved addresses.
  56. <3> IPv6 addresses must be enclosed in square brackets.
  57. <4> The initial master nodes should be identified by their
  58. <<node.name,`node.name`>>, which defaults to their hostname. Make sure that
  59. the value in `cluster.initial_master_nodes` matches the `node.name`
  60. exactly. If you use a fully-qualified domain name such as
  61. `master-node-a.example.com` for your node names then you must use the
  62. fully-qualified name in this list; conversely if `node.name` is a bare
  63. hostname without any trailing qualifiers then you must also omit the
  64. trailing qualifiers in `cluster.initial_master_nodes`.
  65. For more information, see <<modules-discovery-bootstrap-cluster>> and
  66. <<modules-discovery-settings>>.