discovery-settings.asciidoc 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 unsafe>>,
  48. when starting a new cluster in production mode, you must explicitly list the
  49. master-eligible nodes whose votes should be counted in the very first election.
  50. You set this list using the `cluster.initial_master_nodes` setting on every
  51. master-eligible node. Do not configure this setting on master-ineligible nodes.
  52. IMPORTANT: After the cluster forms successfully for the first time, remove the
  53. `cluster.initial_master_nodes` setting from each node's configuration and never
  54. set it again for this cluster. Do not configure this setting on nodes joining
  55. an existing cluster. Do not configure this setting on nodes which are
  56. restarting. Do not configure this setting when performing a full-cluster
  57. restart. See <<modules-discovery-bootstrap-cluster>>.
  58. [source,yaml]
  59. --------------------------------------------------
  60. discovery.seed_hosts:
  61. - 192.168.1.10:9300
  62. - 192.168.1.11
  63. - seeds.mydomain.com
  64. - [0:0:0:0:0:ffff:c0a8:10c]:9301
  65. cluster.initial_master_nodes: <1>
  66. - master-node-a
  67. - master-node-b
  68. - master-node-c
  69. --------------------------------------------------
  70. <1> Identify the initial master nodes by their <<node-name,`node.name`>>, which
  71. defaults to their hostname. Ensure that the value in
  72. `cluster.initial_master_nodes` matches the `node.name` exactly. If you use a
  73. fully-qualified domain name (FQDN) such as `master-node-a.example.com` for your
  74. node names, then you must use the FQDN in this list. Conversely, if `node.name`
  75. is a bare hostname without any trailing qualifiers, you must also omit the
  76. trailing qualifiers in `cluster.initial_master_nodes`.
  77. See <<modules-discovery-bootstrap-cluster,bootstrapping a cluster>> and
  78. <<modules-discovery-settings,discovery and cluster formation settings>>.