2
2
=== Bootstrapping a cluster
3
3
4
4
Starting an Elasticsearch cluster for the very first time requires the initial
5
- set of <<master-node,master-eligible nodes>> to be explicitly defined on one or more of the
6
- master-eligible nodes in the cluster. This is known as _cluster bootstrapping_.
7
- This is only required the very first time the cluster starts up: nodes that
8
- have already joined a cluster store this information in their data folder
9
- and freshly-started nodes that are joining an existing cluster
5
+ set of <<master-node,master-eligible nodes>> to be explicitly defined on one or
6
+ more of the master-eligible nodes in the cluster. This is known as _cluster
7
+ bootstrapping_. This is only required the very first time the cluster starts
8
+ up: nodes that have already joined a cluster store this information in their
9
+ data folder and freshly-started nodes that are joining an existing cluster
10
10
obtain this information from the cluster's elected master. This information is
11
11
given using this setting:
12
12
@@ -17,15 +17,29 @@ given using this setting:
17
17
this list is empty, meaning that this node expects to join a cluster that
18
18
has already been bootstrapped.
19
19
20
- This setting can be given on the command line when starting up each
21
- master-eligible node, or added to the `elasticsearch.yml` configuration file on
22
- those nodes. Once the cluster has formed this setting is no longer required and
23
- is ignored. It need not be set on master-ineligible nodes, nor on
24
- master-eligible nodes that are started to join an existing cluster. Note that
25
- master-eligible nodes should use storage that persists across restarts. If they
26
- do not, and `cluster.initial_master_nodes` is set, and a full cluster restart
27
- occurs, then another brand-new cluster will form and this may result in data
28
- loss.
20
+ This setting can be given on the command line or in the `elasticsearch.yml`
21
+ configuration file when starting up a master-eligible node. Once the cluster
22
+ has formed this setting is no longer required and is ignored. It need not be set
23
+ on master-ineligible nodes, nor on master-eligible nodes that are started to
24
+ join an existing cluster. Note that master-eligible nodes should use storage
25
+ that persists across restarts. If they do not, and
26
+ `cluster.initial_master_nodes` is set, and a full cluster restart occurs, then
27
+ another brand-new cluster will form and this may result in data loss.
28
+
29
+ It is technically sufficient to set `cluster.initial_master_nodes` on a single
30
+ master-eligible node in the cluster, and only to mention that single node in the
31
+ setting's value, but this provides no fault tolerance before the cluster has
32
+ fully formed. It is therefore better to bootstrap using at least three
33
+ master-eligible nodes, each with a `cluster.initial_master_nodes` setting
34
+ containing all three nodes.
35
+
36
+ NOTE: In alpha releases, all listed master-eligible nodes are required to be
37
+ discovered before bootstrapping can take place. This requirement will be relaxed
38
+ in production-ready releases.
39
+
40
+ WARNING: You must set `cluster.initial_master_nodes` to the same list of nodes
41
+ on each node on which it is set in order to be sure that only a single cluster
42
+ forms during bootstrapping and therefore to avoid the risk of data loss.
29
43
30
44
For a cluster with 3 master-eligible nodes (with <<node.name,node names>>
31
45
`master-a`, `master-b` and `master-c`) the configuration will look as follows:
@@ -40,8 +54,8 @@ cluster.initial_master_nodes:
40
54
41
55
Alternatively the IP addresses or hostnames (<<node.name,if node name defaults
42
56
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
44
- given to specify exactly which node is meant:
57
+ with the same IP address or hostname then the transport ports must also be given
58
+ to specify exactly which node is meant:
45
59
46
60
[source,yaml]
47
61
--------------------------------------------------
@@ -52,58 +66,39 @@ cluster.initial_master_nodes:
52
66
- master-node-hostname
53
67
--------------------------------------------------
54
68
55
- Like all node settings, it is also possible to specify the initial set of
56
- master nodes on the command-line that is used to start Elasticsearch:
69
+ Like all node settings, it is also possible to specify the initial set of master
70
+ nodes on the command-line that is used to start Elasticsearch:
57
71
58
72
[source,bash]
59
73
--------------------------------------------------
60
74
$ bin/elasticsearch -Ecluster.initial_master_nodes=master-a,master-b,master-c
61
75
--------------------------------------------------
62
76
63
- It is technically sufficient to set this on a single master-eligible node in
64
- the cluster, and only to mention that single node in the setting, but this
65
- provides no fault tolerance before the cluster has fully formed. It
66
- is therefore better to bootstrap using at least three master-eligible nodes.
67
- In any case, when specifying the list of initial master nodes, **it is vitally
68
- important** to configure each node with exactly the same list of nodes, to
69
- prevent two independent clusters from forming. Typically you will set this on
70
- the nodes that are mentioned in the list of initial master nodes.
71
-
72
- NOTE: In alpha releases, all listed master-eligible nodes are required to be
73
- discovered before bootstrapping can take place. This requirement will be
74
- relaxed in production-ready releases.
75
-
76
- WARNING: You must put exactly the same set of initial master nodes in each
77
- configuration file (or leave the configuration empty) in order to be sure
78
- that only a single cluster forms during bootstrapping and therefore to
79
- avoid the risk of data loss.
80
-
81
77
[float]
82
78
==== Choosing a cluster name
83
79
84
- The <<cluster.name,`cluster.name`>> setting enables you to create multiple clusters which are separated
85
- from each other. Nodes verify that they agree on their cluster name when they
86
- first connect to each other. If two nodes have different cluster names,
87
- they will not communicate meaningfully and will not belong to the same cluster.
88
- The default value for the cluster name is `elasticsearch`, but it is
89
- recommended to change this to reflect the logical name of the cluster.
80
+ The <<cluster.name,`cluster.name`>> setting enables you to create multiple
81
+ clusters which are separated from each other. Nodes verify that they agree on
82
+ their cluster name when they first connect to each other, and Elasticsearch
83
+ will only form a cluster from nodes that all have the same cluster name. The
84
+ default value for the cluster name is `elasticsearch`, but it is recommended to
85
+ change this to reflect the logical name of the cluster.
90
86
91
87
[float]
92
88
==== Auto-bootstrapping in development mode
93
89
94
90
If the cluster is running with a completely default configuration then it will
95
- automatically bootstrap a cluster based on the nodes that could be discovered
96
- to be running on the same host within a short time after startup. This means
97
- that by default it is possible to start up several nodes on a single machine
98
- and have them automatically form a cluster which is very useful for development
91
+ automatically bootstrap a cluster based on the nodes that could be discovered to
92
+ be running on the same host within a short time after startup. This means that
93
+ by default it is possible to start up several nodes on a single machine and have
94
+ them automatically form a cluster which is very useful for development
99
95
environments and experimentation. However, since nodes may not always
100
96
successfully discover each other quickly enough this automatic bootstrapping
101
97
cannot be relied upon and cannot be used in production deployments.
102
98
103
- If any of the following settings are configured then auto-bootstrapping will
104
- not take place, and you must configure `cluster.initial_master_nodes` as
105
- described in the <<modules-discovery-bootstrap-cluster,section on cluster
106
- bootstrapping>>:
99
+ If any of the following settings are configured then auto-bootstrapping will not
100
+ take place, and you must configure `cluster.initial_master_nodes` as described
101
+ in the <<modules-discovery-bootstrap-cluster,section on cluster bootstrapping>>:
107
102
108
103
* `discovery.zen.hosts_provider`
109
104
* `discovery.zen.ping.unicast.hosts`
0 commit comments