bootstrapping.asciidoc 4.9 KB

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