bootstrapping.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. [[modules-discovery-bootstrap-cluster]]
  2. === Bootstrapping a cluster
  3. Starting an Elasticsearch cluster for the very first time requires the initial
  4. set of <<master-node,master-eligible nodes>> to be explicitly defined on one or
  5. more of the master-eligible nodes in the cluster. This is known as _cluster
  6. bootstrapping_. This is only required the very first time the cluster starts
  7. up: nodes that have already joined a cluster store this information in their
  8. data folder and freshly-started nodes that are joining an existing cluster
  9. obtain this information from the cluster's elected master.
  10. The initial set of master-eligible nodes is defined in the
  11. <<initial_master_nodes,`cluster.initial_master_nodes` setting>>. When you
  12. start a master-eligible node, you can provide this setting on the command line
  13. or in the `elasticsearch.yml` file. After the cluster has formed, this setting
  14. is no longer required and is ignored. It need not be set
  15. on master-ineligible nodes, nor on master-eligible nodes that are started to
  16. join an existing cluster. Note that master-eligible nodes should use storage
  17. that persists across restarts. If they do not, and
  18. `cluster.initial_master_nodes` is set, and a full cluster restart occurs, then
  19. another brand-new cluster will form and this may result in data loss.
  20. It is technically sufficient to set `cluster.initial_master_nodes` on a single
  21. master-eligible node in the cluster, and only to mention that single node in the
  22. setting's value, but this provides no fault tolerance before the cluster has
  23. fully formed. It is therefore better to bootstrap using at least three
  24. master-eligible nodes, each with a `cluster.initial_master_nodes` setting
  25. containing all three nodes.
  26. NOTE: In alpha releases, all listed master-eligible nodes are required to be
  27. discovered before bootstrapping can take place. This requirement will be relaxed
  28. in production-ready releases.
  29. WARNING: You must set `cluster.initial_master_nodes` to the same list of nodes
  30. on each node on which it is set in order to be sure that only a single cluster
  31. forms during bootstrapping and therefore to avoid the risk of data loss.
  32. For a cluster with 3 master-eligible nodes (with <<node.name,node names>>
  33. `master-a`, `master-b` and `master-c`) the configuration will look as follows:
  34. [source,yaml]
  35. --------------------------------------------------
  36. cluster.initial_master_nodes:
  37. - master-a
  38. - master-b
  39. - master-c
  40. --------------------------------------------------
  41. Alternatively the IP addresses or hostnames (<<node.name,if node name defaults
  42. to the host name>>) can be used. If there is more than one Elasticsearch node
  43. with the same IP address or hostname then the transport ports must also be given
  44. to specify exactly which node is meant:
  45. [source,yaml]
  46. --------------------------------------------------
  47. cluster.initial_master_nodes:
  48. - 10.0.10.101
  49. - 10.0.10.102:9300
  50. - 10.0.10.102:9301
  51. - master-node-hostname
  52. --------------------------------------------------
  53. Like all node settings, it is also possible to specify the initial set of master
  54. nodes on the command-line that is used to start Elasticsearch:
  55. [source,bash]
  56. --------------------------------------------------
  57. $ bin/elasticsearch -Ecluster.initial_master_nodes=master-a,master-b,master-c
  58. --------------------------------------------------
  59. [float]
  60. ==== Choosing a cluster name
  61. The <<cluster.name,`cluster.name`>> setting enables you to create multiple
  62. clusters which are separated from each other. Nodes verify that they agree on
  63. their cluster name when they first connect to each other, and Elasticsearch
  64. will only form a cluster from nodes that all have the same cluster name. The
  65. default value for the cluster name is `elasticsearch`, but it is recommended to
  66. change this to reflect the logical name of the cluster.
  67. [float]
  68. ==== Auto-bootstrapping in development mode
  69. If the cluster is running with a completely default configuration then it will
  70. automatically bootstrap a cluster based on the nodes that could be discovered to
  71. be running on the same host within a short time after startup. This means that
  72. by default it is possible to start up several nodes on a single machine and have
  73. them automatically form a cluster which is very useful for development
  74. environments and experimentation. However, since nodes may not always
  75. successfully discover each other quickly enough this automatic bootstrapping
  76. cannot be relied upon and cannot be used in production deployments.
  77. If any of the following settings are configured then auto-bootstrapping will not
  78. take place, and you must configure `cluster.initial_master_nodes` as described
  79. in the <<modules-discovery-bootstrap-cluster,section on cluster bootstrapping>>:
  80. * `discovery.seed_providers`
  81. * `discovery.seed_hosts`
  82. * `cluster.initial_master_nodes`