Skip to content

Commit f0fac9f

Browse files
authored
Further clarify cluster.initial_master_nodes (#41179)
The following phrase causes confusion: > Alternatively the IP addresses or hostnames (if node name defaults to the > host name) can be used. This change clarifies the conditions under which you can use a hostname, and adds an anchor to the note introduced in (#41137) so we can link directly to it in conversations with users.
1 parent c86e7f1 commit f0fac9f

File tree

2 files changed

+42
-34
lines changed

2 files changed

+42
-34
lines changed

docs/reference/modules/discovery/bootstrapping.asciidoc

+34-28
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,21 @@ up: nodes that have already joined a cluster store this information in their
99
data folder and freshly-started nodes that are joining an existing cluster
1010
obtain this information from the cluster's elected master.
1111

12-
The initial set of master-eligible nodes is defined in the
13-
<<initial_master_nodes,`cluster.initial_master_nodes` setting>>. When you
14-
start a master-eligible node, you can provide this setting on the command line
15-
or in the `elasticsearch.yml` file. After the cluster has formed, this setting
16-
is no longer required and is ignored. It need not be set
17-
on master-ineligible nodes, nor on master-eligible nodes that are started to
18-
join an existing cluster. Note that master-eligible nodes should use storage
19-
that persists across restarts. If they do not, and
20-
`cluster.initial_master_nodes` is set, and a full cluster restart occurs, then
21-
another brand-new cluster will form and this may result in data loss.
12+
The initial set of master-eligible nodes is defined in the
13+
<<initial_master_nodes,`cluster.initial_master_nodes` setting>>. This is a list
14+
of the <<node.name,node names>> or IP addresses of the master-eligible nodes in
15+
the new cluster. If you do not configure `node.name` then it is set to the
16+
node's hostname, so in this case you can use hostnames in
17+
`cluster.initial_master_nodes` too.
18+
19+
When you start a master-eligible node, you can provide this setting on the
20+
command line or in the `elasticsearch.yml` file. After the cluster has formed,
21+
this setting is no longer required and is ignored. It need not be set on
22+
master-ineligible nodes, nor on master-eligible nodes that are started to join
23+
an existing cluster. Note that master-eligible nodes should use storage that
24+
persists across restarts. If they do not, and `cluster.initial_master_nodes` is
25+
set, and a full cluster restart occurs, then another brand-new cluster will
26+
form and this may result in data loss.
2227

2328
It is technically sufficient to set `cluster.initial_master_nodes` on a single
2429
master-eligible node in the cluster, and only to mention that single node in the
@@ -42,10 +47,9 @@ cluster.initial_master_nodes:
4247
- master-c
4348
--------------------------------------------------
4449

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:
50+
You can use a mix of IP addresses and node names too. If there is more than one
51+
Elasticsearch node with the same IP address then the transport port must also
52+
be given to specify exactly which node is meant:
4953

5054
[source,yaml]
5155
--------------------------------------------------
@@ -56,14 +60,23 @@ cluster.initial_master_nodes:
5660
- master-node-hostname
5761
--------------------------------------------------
5862

63+
Like all node settings, it is also possible to specify the initial set of master
64+
nodes on the command-line that is used to start Elasticsearch:
65+
66+
[source,bash]
67+
--------------------------------------------------
68+
$ bin/elasticsearch -Ecluster.initial_master_nodes=master-a,master-b,master-c
69+
--------------------------------------------------
70+
5971
[NOTE]
6072
==================================================
6173
62-
The node names used in this list must exactly match the `node.name` properties
63-
of the nodes. By default the node name is set to the machine's hostname which
64-
may or may not be fully-qualified depending on your system configuration. If
65-
each node name is a fully-qualified domain name such as `master-a.example.com`
66-
then you must use fully-qualified domain names in the
74+
[[modules-discovery-bootstrap-cluster-fqdns]] The node names used in the
75+
`cluster.initial_master_nodes` list must exactly match the `node.name`
76+
properties of the nodes. By default the node name is set to the machine's
77+
hostname which may or may not be fully-qualified depending on your system
78+
configuration. If each node name is a fully-qualified domain name such as
79+
`master-a.example.com` then you must use fully-qualified domain names in the
6780
`cluster.initial_master_nodes` list too; conversely if your node names are bare
6881
hostnames (without the `.example.com` suffix) then you must use bare hostnames
6982
in the `cluster.initial_master_nodes` list. If you use a mix of fully-qualifed
@@ -81,18 +94,11 @@ bootstrap a cluster: have discovered [{master-b.example.com}{...
8194
8295
This message shows the node names `master-a.example.com` and
8396
`master-b.example.com` as well as the `cluster.initial_master_nodes` entries
84-
`master-a` and `master-b`, and it is apparent that they do not match exactly.
97+
`master-a` and `master-b`, and it is clear from this message that they do not
98+
match exactly.
8599
86100
==================================================
87101

88-
Like all node settings, it is also possible to specify the initial set of master
89-
nodes on the command-line that is used to start Elasticsearch:
90-
91-
[source,bash]
92-
--------------------------------------------------
93-
$ bin/elasticsearch -Ecluster.initial_master_nodes=master-a,master-b,master-c
94-
--------------------------------------------------
95-
96102
[float]
97103
==== Choosing a cluster name
98104

docs/reference/setup/important-settings/discovery-settings.asciidoc

+8-6
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ cluster.initial_master_nodes:
5858
`transport.port` if not specified.
5959
<2> If a hostname resolves to multiple IP addresses then the node will attempt to
6060
discover other nodes at all resolved addresses.
61-
<3> Initial master nodes can be identified by their <<node.name,`node.name`>>.
62-
Make sure that the value here matches the `node.name` exactly. If you use a
63-
fully-qualified domain name such as `master-node-a.example.com` for your
61+
<3> Initial master nodes can be identified by their <<node.name,`node.name`>>,
62+
which defaults to the hostname. Make sure that the value in
63+
`cluster.initial_master_nodes` matches the `node.name` exactly. If you use
64+
a fully-qualified domain name such as `master-node-a.example.com` for your
6465
node names then you must use the fully-qualified name in this list;
6566
conversely if `node.name` is a bare hostname without any trailing
6667
qualifiers then you must also omit the trailing qualifiers in
6768
`cluster.initial_master_nodes`.
6869
<4> Initial master nodes can also be identified by their IP address.
69-
<5> If multiple master nodes share an IP address then the port must be used to
70-
disambiguate them.
70+
<5> If multiple master nodes share an IP address then the transport port must
71+
be used to distinguish between them.
7172

72-
For more information, see <<modules-discovery-settings>>.
73+
For more information, see <<modules-discovery-bootstrap-cluster>> and
74+
<<modules-discovery-settings>>.

0 commit comments

Comments
 (0)