discovery-settings.asciidoc 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. [[discovery-settings]]
  2. [discrete]
  3. ==== Discovery and cluster formation settings
  4. Configure two important discovery and cluster formation settings before going
  5. to production so that nodes in the cluster can discover each other and elect a
  6. master node.
  7. [discrete]
  8. [[unicast.hosts]]
  9. ===== `discovery.seed_hosts`
  10. Out of the box, without any network configuration, {es} will bind to
  11. the available loopback addresses and scan local ports `9300` to `9305` to
  12. connect with other nodes running on the same server. This behavior provides an
  13. auto-clustering experience without having to do any configuration.
  14. When you want to form a cluster with nodes on other hosts, use the
  15. <<static-cluster-setting, static>> `discovery.seed_hosts` setting. This setting
  16. provides a list of other nodes in the cluster
  17. that are master-eligible and likely to be live and contactable to seed
  18. the <<discovery-hosts-providers,discovery process>>. This setting
  19. accepts a YAML sequence or array of the addresses of all the master-eligible
  20. nodes in the cluster. Each address can be either an IP address or a hostname
  21. that resolves to one or more IP addresses via DNS.
  22. [source,yaml]
  23. ----
  24. discovery.seed_hosts:
  25. - 192.168.1.10:9300
  26. - 192.168.1.11 <1>
  27. - seeds.mydomain.com <2>
  28. - [0:0:0:0:0:ffff:c0a8:10c]:9301 <3>
  29. ----
  30. <1> The port is optional and defaults to `9300`, but can
  31. be <<built-in-hosts-providers,overridden>>.
  32. <2> If a hostname resolves to multiple IP addresses, the node will attempt to
  33. discover other nodes at all resolved addresses.
  34. <3> IPv6 addresses must be enclosed in square brackets.
  35. If your master-eligible nodes do not have fixed names or addresses, use an
  36. <<built-in-hosts-providers,alternative hosts provider>> to find their addresses
  37. dynamically.
  38. [discrete]
  39. [[initial_master_nodes]]
  40. ===== `cluster.initial_master_nodes`
  41. When you start an {es} cluster for the first time, a
  42. <<modules-discovery-bootstrap-cluster,cluster bootstrapping>> step
  43. determines the set of master-eligible nodes whose votes are counted in the
  44. first election. In <<dev-vs-prod-mode,development mode>>, with no discovery
  45. settings configured, this step is performed automatically by the nodes
  46. themselves.
  47. Because auto-bootstrapping is <<modules-discovery-quorums,inherently
  48. unsafe>>, when starting a new cluster in production
  49. mode, you must explicitly list the master-eligible nodes whose votes should be
  50. counted in the very first election. You set this list using the
  51. `cluster.initial_master_nodes` setting.
  52. IMPORTANT: After the cluster forms successfully for the first time, remove the
  53. `cluster.initial_master_nodes` setting from each node's configuration. Do not
  54. use this setting when restarting a cluster or adding a new node to an existing
  55. cluster.
  56. [source,yaml]
  57. --------------------------------------------------
  58. discovery.seed_hosts:
  59. - 192.168.1.10:9300
  60. - 192.168.1.11
  61. - seeds.mydomain.com
  62. - [0:0:0:0:0:ffff:c0a8:10c]:9301
  63. cluster.initial_master_nodes: <1>
  64. - master-node-a
  65. - master-node-b
  66. - master-node-c
  67. --------------------------------------------------
  68. <1> Identify the initial master nodes by their <<node-name,`node.name`>>, which
  69. defaults to their hostname. Ensure that the value in
  70. `cluster.initial_master_nodes` matches the `node.name` exactly. If you use a
  71. fully-qualified domain name (FQDN) such as `master-node-a.example.com` for your
  72. node names, then you must use the FQDN in this list. Conversely, if `node.name`
  73. is a bare hostname without any trailing qualifiers, you must also omit the
  74. trailing qualifiers in `cluster.initial_master_nodes`.
  75. See <<modules-discovery-bootstrap-cluster,bootstrapping a cluster>> and
  76. <<modules-discovery-settings,discovery and cluster formation settings>>.