Introduce node.roles setting (#54998)

Today we have individual settings for configuring node roles such as
node.data and node.master. Additionally, roles are pluggable and we have
used this to introduce roles such as node.ml and node.voting_only. As
the number of roles is growing, managing these becomes harder for the
user. For example, to create a master-only node, today a user has to
configure:
 - node.data: false
 - node.ingest: false
 - node.remote_cluster_client: false
 - node.ml: false

at a minimum if they are relying on defaults, but also add:
 - node.master: true
 - node.transform: false
 - node.voting_only: false

If they want to be explicit. This is also challenging in cases where a
user wants to have configure a coordinating-only node which requires
disabling all roles, a list which we are adding to, requiring the user
to keep checking whether a node has acquired any of these roles.

This commit addresses this by adding a list setting node.roles for which
a user has explicit control over the list of roles that a node has. If
the setting is configured, the node has exactly the roles in the list,
and not any additional roles. This means to configure a master-only
node, the setting is merely 'node.roles: [master]', and to configure a
coordinating-only node, the setting is merely: 'node.roles: []'.

With this change we deprecate the existing 'node.*' settings such as
'node.data'.
This commit is contained in:
Jason Tedor 2020-06-24 14:46:31 -04:00 committed by GitHub
parent 91cc417aba
commit a914d84429
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
82 changed files with 987 additions and 755 deletions

View file

@ -62,17 +62,16 @@ after repurposing it.
The intended use is:
* Stop the node
* Update `elasticsearch.yml` by setting `node.master` and `node.data` as
desired.
* Update `elasticsearch.yml` by setting `node.roles` as desired.
* Run `elasticsearch-node repurpose` on the node
* Start the node
If you run `elasticsearch-node repurpose` on a node with `node.data: false` and
`node.master: true` then it will delete any remaining shard data on that node,
but it will leave the index and cluster metadata alone. If you run
`elasticsearch-node repurpose` on a node with `node.data: false` and
`node.master: false` then it will delete any remaining shard data and index
metadata, but it will leave the cluster metadata alone.
If you run `elasticsearch-node repurpose` on a node without the `data` role and
with the `master` role then it will delete any remaining shard data on that
node, but it will leave the index and cluster metadata alone. If you run
`elasticsearch-node repurpose` on a node without the `data` and `master` roles
then it will delete any remaining shard data and index metadata, but it will
leave the cluster metadata alone.
[WARNING]
Running this command can lead to data loss for the indices mentioned if the
@ -351,12 +350,12 @@ from the on-disk cluster state.
=== Examples
[float]
==== Repurposing a node as a dedicated master node (master: true, data: false)
==== Repurposing a node as a dedicated master node
In this example, a former data node is repurposed as a dedicated master node.
First update the node's settings to `node.master: true` and `node.data: false`
in its `elasticsearch.yml` config file. Then run the `elasticsearch-node
repurpose` command to find and remove excess shard data:
First update the node's settings to `node.roles: [ "master" ]` in its
`elasticsearch.yml` config file. Then run the `elasticsearch-node repurpose`
command to find and remove excess shard data:
[source,txt]
----
@ -373,13 +372,13 @@ Node successfully repurposed to master and no-data.
----
[float]
==== Repurposing a node as a coordinating-only node (master: false, data: false)
==== Repurposing a node as a coordinating-only node
In this example, a node that previously held data is repurposed as a
coordinating-only node. First update the node's settings to `node.master:
false` and `node.data: false` in its `elasticsearch.yml` config file. Then run
the `elasticsearch-node repurpose` command to find and remove excess shard data
and index metadata:
coordinating-only node. First update the node's settings to `node.roles: []` in
its `elasticsearch.yml` config file. Then run the `elasticsearch-node repurpose`
command to find and remove excess shard data and index metadata:
[source,txt]
----