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.
This commit is contained in:
David Turner 2019-04-14 10:39:50 +01:00
parent c8bc4ab003
commit 5ef247dc91
2 changed files with 42 additions and 34 deletions

View File

@ -9,16 +9,21 @@ up: nodes that have already joined a cluster store this information in their
data folder and freshly-started nodes that are joining an existing cluster data folder and freshly-started nodes that are joining an existing cluster
obtain this information from the cluster's elected master. obtain this information from the cluster's elected master.
The initial set of master-eligible nodes is defined in the The initial set of master-eligible nodes is defined in the
<<initial_master_nodes,`cluster.initial_master_nodes` setting>>. When you <<initial_master_nodes,`cluster.initial_master_nodes` setting>>. This is a list
start a master-eligible node, you can provide this setting on the command line of the <<node.name,node names>> or IP addresses of the master-eligible nodes in
or in the `elasticsearch.yml` file. After the cluster has formed, this setting the new cluster. If you do not configure `node.name` then it is set to the
is no longer required and is ignored. It need not be set node's hostname, so in this case you can use hostnames in
on master-ineligible nodes, nor on master-eligible nodes that are started to `cluster.initial_master_nodes` too.
join an existing cluster. Note that master-eligible nodes should use storage
that persists across restarts. If they do not, and When you start a master-eligible node, you can provide this setting on the
`cluster.initial_master_nodes` is set, and a full cluster restart occurs, then command line or in the `elasticsearch.yml` file. After the cluster has formed,
another brand-new cluster will form and this may result in data loss. this setting is no longer required and is ignored. It need not be set on
master-ineligible nodes, nor on master-eligible nodes that are started to join
an existing cluster. Note that master-eligible nodes should use storage that
persists across restarts. If they do not, and `cluster.initial_master_nodes` is
set, and a full cluster restart occurs, then another brand-new cluster will
form and this may result in data loss.
It is technically sufficient to set `cluster.initial_master_nodes` on a single It is technically sufficient to set `cluster.initial_master_nodes` on a single
master-eligible node in the cluster, and only to mention that single node in the master-eligible node in the cluster, and only to mention that single node in the
@ -42,10 +47,9 @@ cluster.initial_master_nodes:
- master-c - master-c
-------------------------------------------------- --------------------------------------------------
Alternatively the IP addresses or hostnames (<<node.name,if node name defaults You can use a mix of IP addresses and node names too. If there is more than one
to the host name>>) can be used. If there is more than one Elasticsearch node Elasticsearch node with the same IP address then the transport port must also
with the same IP address or hostname then the transport ports must also be given be given to specify exactly which node is meant:
to specify exactly which node is meant:
[source,yaml] [source,yaml]
-------------------------------------------------- --------------------------------------------------
@ -56,14 +60,23 @@ cluster.initial_master_nodes:
- master-node-hostname - master-node-hostname
-------------------------------------------------- --------------------------------------------------
Like all node settings, it is also possible to specify the initial set of master
nodes on the command-line that is used to start Elasticsearch:
[source,bash]
--------------------------------------------------
$ bin/elasticsearch -Ecluster.initial_master_nodes=master-a,master-b,master-c
--------------------------------------------------
[NOTE] [NOTE]
================================================== ==================================================
The node names used in this list must exactly match the `node.name` properties [[modules-discovery-bootstrap-cluster-fqdns]] The node names used in the
of the nodes. By default the node name is set to the machine's hostname which `cluster.initial_master_nodes` list must exactly match the `node.name`
may or may not be fully-qualified depending on your system configuration. If properties of the nodes. By default the node name is set to the machine's
each node name is a fully-qualified domain name such as `master-a.example.com` hostname which may or may not be fully-qualified depending on your system
then you must use fully-qualified domain names in the configuration. If each node name is a fully-qualified domain name such as
`master-a.example.com` then you must use fully-qualified domain names in the
`cluster.initial_master_nodes` list too; conversely if your node names are bare `cluster.initial_master_nodes` list too; conversely if your node names are bare
hostnames (without the `.example.com` suffix) then you must use bare hostnames hostnames (without the `.example.com` suffix) then you must use bare hostnames
in the `cluster.initial_master_nodes` list. If you use a mix of fully-qualifed 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}{...
This message shows the node names `master-a.example.com` and This message shows the node names `master-a.example.com` and
`master-b.example.com` as well as the `cluster.initial_master_nodes` entries `master-b.example.com` as well as the `cluster.initial_master_nodes` entries
`master-a` and `master-b`, and it is apparent that they do not match exactly. `master-a` and `master-b`, and it is clear from this message that they do not
match exactly.
================================================== ==================================================
Like all node settings, it is also possible to specify the initial set of master
nodes on the command-line that is used to start Elasticsearch:
[source,bash]
--------------------------------------------------
$ bin/elasticsearch -Ecluster.initial_master_nodes=master-a,master-b,master-c
--------------------------------------------------
[float] [float]
==== Choosing a cluster name ==== Choosing a cluster name

View File

@ -58,15 +58,17 @@ cluster.initial_master_nodes:
`transport.port` if not specified. `transport.port` if not specified.
<2> If a hostname resolves to multiple IP addresses then the node will attempt to <2> If a hostname resolves to multiple IP addresses then the node will attempt to
discover other nodes at all resolved addresses. discover other nodes at all resolved addresses.
<3> Initial master nodes can be identified by their <<node.name,`node.name`>>. <3> Initial master nodes can be identified by their <<node.name,`node.name`>>,
Make sure that the value here matches the `node.name` exactly. If you use a which defaults to the hostname. Make sure that the value in
fully-qualified domain name such as `master-node-a.example.com` for your `cluster.initial_master_nodes` matches the `node.name` exactly. If you use
a fully-qualified domain name such as `master-node-a.example.com` for your
node names then you must use the fully-qualified name in this list; node names then you must use the fully-qualified name in this list;
conversely if `node.name` is a bare hostname without any trailing conversely if `node.name` is a bare hostname without any trailing
qualifiers then you must also omit the trailing qualifiers in qualifiers then you must also omit the trailing qualifiers in
`cluster.initial_master_nodes`. `cluster.initial_master_nodes`.
<4> Initial master nodes can also be identified by their IP address. <4> Initial master nodes can also be identified by their IP address.
<5> If multiple master nodes share an IP address then the port must be used to <5> If multiple master nodes share an IP address then the transport port must
disambiguate them. be used to distinguish between them.
For more information, see <<modules-discovery-settings>>. For more information, see <<modules-discovery-bootstrap-cluster>> and
<<modules-discovery-settings>>.