Skip to content

Commit 1fc0432

Browse files
authored
Introduce formal role for remote cluster client (#53924)
This commit introduce a formal role for identifying nodes that are capable of making connections to remote clusters.
1 parent 8ee7705 commit 1fc0432

File tree

33 files changed

+191
-96
lines changed

33 files changed

+191
-96
lines changed

distribution/docker/src/test/resources/rest-api-spec/test/11_nodes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- match:
88
$body: |
99
/ #ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10-
^ ((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)?\s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmt]{1,5}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
10+
^ ((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)?\s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmrt]{1,6}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
1111
1212
- do:
1313
cat.nodes:
@@ -16,7 +16,7 @@
1616
- match:
1717
$body: |
1818
/^ ip \s+ heap\.percent \s+ ram\.percent \s+ cpu \s+ load_1m \s+ load_5m \s+ load_15m \s+ node\.role \s+ master \s+ name \n
19-
((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmt]{1,5}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
19+
((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmrt]{1,6}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
2020
2121
- do:
2222
cat.nodes:

docs/reference/migration/migrate_8_0/settings.asciidoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@ processors. As this leads to more context switches and more threads but without
3737
an increase in the number of physical CPUs on which to schedule these additional
3838
threads, the `node.processors` setting is now bounded by the number of available
3939
processors.
40+
41+
[float]
42+
==== `cluster.remote.connect` is deprecated in favor of `node.remote_cluster_client`
43+
44+
Previously the setting `cluster.remote.connect` was used to configure whether or
45+
not the local node is capable of acting as a remote cluster client in
46+
cross-cluster search and cross-cluster replication. This setting is deprecated
47+
in favor of `node.remote_cluster_client` serves the same purpose and identifies
48+
the local node as having the `remote_cluster_client` role.

docs/reference/ml/ml-shared.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ An array of index names. Wildcards are supported. For example:
798798
`["it_ops_metrics", "server*"]`.
799799
+
800800
--
801-
NOTE: If any indices are in remote clusters then `cluster.remote.connect` must
802-
not be set to `false` on any {ml} nodes.
801+
NOTE: If any indices are in remote clusters then `node.remote_cluster_client`
802+
must not be set to `false` on any {ml} nodes.
803803

804804
--
805805
end::indices[]

docs/reference/modules/node.asciidoc

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[[modules-node]]
22
== Node
33

4-
Any time that you start an instance of Elasticsearch, you are starting a _node_.
5-
A collection of connected nodes is called a <<modules-cluster,cluster>>. If you
4+
Any time that you start an instance of Elasticsearch, you are starting a _node_.
5+
A collection of connected nodes is called a <<modules-cluster,cluster>>. If you
66
are running a single node of {es}, then you have a cluster of one node.
77

88
Every node in the cluster can handle <<modules-http,HTTP>> and
@@ -11,7 +11,7 @@ exclusively for communication between nodes; the HTTP layer is used by REST
1111
clients.
1212

1313
All nodes know about all the other nodes in the cluster and can forward client
14-
requests to the appropriate node.
14+
requests to the appropriate node.
1515

1616
By default, a node is all of the following types: master-eligible, data, ingest,
1717
and machine learning (if available).
@@ -95,22 +95,22 @@ be elected to become the master node by the <<modules-discovery,master election
9595
process>>.
9696

9797
IMPORTANT: Master nodes must have access to the `data/` directory (just like
98-
`data` nodes) as this is where the cluster state is persisted between node
98+
`data` nodes) as this is where the cluster state is persisted between node
9999
restarts.
100100

101101
[float]
102102
[[dedicated-master-node]]
103103
==== Dedicated master-eligible node
104104

105-
It is important for the health of the cluster that the elected master node has
106-
the resources it needs to fulfill its responsibilities. If the elected master
107-
node is overloaded with other tasks then the cluster may not operate well. In
108-
particular, indexing and searching your data can be very resource-intensive, so
109-
in large or high-throughput clusters it is a good idea to avoid using the
110-
master-eligible nodes for tasks such as indexing and searching. You can do this
111-
by configuring three of your nodes to be dedicated master-eligible nodes.
105+
It is important for the health of the cluster that the elected master node has
106+
the resources it needs to fulfill its responsibilities. If the elected master
107+
node is overloaded with other tasks then the cluster may not operate well. In
108+
particular, indexing and searching your data can be very resource-intensive, so
109+
in large or high-throughput clusters it is a good idea to avoid using the
110+
master-eligible nodes for tasks such as indexing and searching. You can do this
111+
by configuring three of your nodes to be dedicated master-eligible nodes.
112112
Dedicated master-eligible nodes only have the `master` role, allowing them to
113-
focus on managing the cluster. While master nodes can also behave as
113+
focus on managing the cluster. While master nodes can also behave as
114114
<<coordinating-node,coordinating nodes>> and route search and indexing requests
115115
from clients to data nodes, it is better _not_ to use dedicated master nodes for
116116
this purpose.
@@ -127,7 +127,7 @@ node.ml: false <5>
127127
xpack.ml.enabled: true <6>
128128
node.transform: false <7>
129129
xpack.transform.enabled: true <8>
130-
cluster.remote.connect: false <9>
130+
node.remote_client_client: false <9>
131131
-------------------
132132
<1> The `node.master` role is enabled by default.
133133
<2> The `node.voting_only` role is disabled by default.
@@ -146,7 +146,7 @@ To create a dedicated master-eligible node in the {oss-dist}, set:
146146
node.master: true <1>
147147
node.data: false <2>
148148
node.ingest: false <3>
149-
cluster.remote.connect: false <4>
149+
node.remote_cluster_client: false <4>
150150
-------------------
151151
<1> The `node.master` role is enabled by default.
152152
<2> Disable the `node.data` role (enabled by default).
@@ -210,7 +210,7 @@ node.ml: false <5>
210210
xpack.ml.enabled: true <6>
211211
node.transform: false <7>
212212
xpack.transform.enabled: true <8>
213-
cluster.remote.connect: false <9>
213+
node.remote_cluster_client: false <9>
214214
-------------------
215215
<1> The `node.master` role is enabled by default.
216216
<2> Enable the `node.voting_only` role (disabled by default).
@@ -243,7 +243,7 @@ node.data: true <3>
243243
node.ingest: false <4>
244244
node.ml: false <5>
245245
node.transform: false <6>
246-
cluster.remote.connect: false <7>
246+
node.remote_cluster_client: false <7>
247247
-------------------
248248
<1> Disable the `node.master` role (enabled by default).
249249
<2> The `node.voting_only` role is disabled by default.
@@ -259,7 +259,7 @@ To create a dedicated data node in the {oss-dist}, set:
259259
node.master: false <1>
260260
node.data: true <2>
261261
node.ingest: false <3>
262-
cluster.remote.connect: false <4>
262+
node.remote_cluster_client: false <4>
263263
-------------------
264264
<1> Disable the `node.master` role (enabled by default).
265265
<2> The `node.data` role is enabled by default.
@@ -285,7 +285,7 @@ node.data: false <3>
285285
node.ingest: true <4>
286286
node.ml: false <5>
287287
node.transform: false <6>
288-
cluster.remote.connect: false <7>
288+
node.remote_cluster_client: false <7>
289289
-------------------
290290
<1> Disable the `node.master` role (enabled by default).
291291
<2> The `node.voting_only` role is disabled by default.
@@ -302,7 +302,7 @@ To create a dedicated ingest node in the {oss-dist}, set:
302302
node.master: false <1>
303303
node.data: false <2>
304304
node.ingest: true <3>
305-
cluster.remote.connect: false <4>
305+
node.remote_cluster_client: false <4>
306306
-------------------
307307
<1> Disable the `node.master` role (enabled by default).
308308
<2> Disable the `node.data` role (enabled by default).
@@ -340,7 +340,7 @@ node.data: false <3>
340340
node.ingest: false <4>
341341
node.ml: false <5>
342342
node.transform: false <6>
343-
cluster.remote.connect: false <7>
343+
node.remote_cluster_client: false <7>
344344
-------------------
345345
<1> Disable the `node.master` role (enabled by default).
346346
<2> The `node.voting_only` role is disabled by default.
@@ -357,7 +357,7 @@ To create a dedicated coordinating node in the {oss-dist}, set:
357357
node.master: false <1>
358358
node.data: false <2>
359359
node.ingest: false <3>
360-
cluster.remote.connect: false <4>
360+
node.remote_cluster_client: false <4>
361361
-------------------
362362
<1> Disable the `node.master` role (enabled by default).
363363
<2> Disable the `node.data` role (enabled by default).
@@ -390,7 +390,7 @@ node.ml: true <5>
390390
xpack.ml.enabled: true <6>
391391
node.transform: false <7>
392392
xpack.transform.enabled: true <8>
393-
cluster.remote.connect: false <9>
393+
node.remote_cluster_client: false <9>
394394
-------------------
395395
<1> Disable the `node.master` role (enabled by default).
396396
<2> The `node.voting_only` role is disabled by default.
@@ -425,7 +425,7 @@ node.ingest: false <4>
425425
node.ml: false <5>
426426
node.transform: true <6>
427427
xpack.transform.enabled: true <7>
428-
cluster.remote.connect: false <8>
428+
node.remote_cluster_client: false <8>
429429
-------------------
430430
<1> Disable the `node.master` role.
431431
<2> Disable the `node.voting_only`.

docs/reference/modules/remote-clusters.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,12 @@ and <<remote-cluster-proxy-settings,proxy mode settings>> are described below.
254254
The time to wait for remote connections to be established when the node
255255
starts. The default is `30s`.
256256

257-
`cluster.remote.connect`::
257+
`node.remote_cluster_client`::
258258

259259
By default, any node in the cluster can act as a cross-cluster client and
260-
connect to remote clusters. The `cluster.remote.connect` setting can be set to
261-
`false` (defaults to `true`) to prevent certain nodes from connecting to
262-
remote clusters. Remote cluster requests must be sent to a node that is
260+
connect to remote clusters. The `node.remote_cluster_client` setting can be
261+
set to `false` (defaults to `true`) to prevent certain nodes from connecting
262+
to remote clusters. Remote cluster requests must be sent to a node that is
263263
allowed to act as a cross-cluster client.
264264

265265
`cluster.remote.<cluster_alias>.skip_unavailable`::

qa/multi-cluster-search/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ task 'remote-cluster'(type: RestIntegTestTask) {
3535

3636
testClusters.'remote-cluster' {
3737
numberOfNodes = 2
38-
setting 'cluster.remote.connect', 'false'
38+
setting 'node.remote_cluster_client', 'false'
3939
}
4040

4141
task mixedClusterTest(type: RestIntegTestTask) {
@@ -50,7 +50,7 @@ testClusters.mixedClusterTest {
5050
setting 'cluster.remote.my_remote_cluster.seeds',
5151
{ "\"${testClusters.'remote-cluster'.getAllTransportPortURI().get(0)}\"" }
5252
setting 'cluster.remote.connections_per_cluster', '1'
53-
setting 'cluster.remote.connect', 'true'
53+
setting 'node.remote_cluster_client', 'true'
5454
}
5555

5656

rest-api-spec/src/main/resources/rest-api-spec/test/cat.nodes/10_basic.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- match:
88
$body: |
99
/ #ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
10-
^ ((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)?\s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmt]{1,5}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
10+
^ ((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)?\s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmrt]{1,6}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
1111
1212
- do:
1313
cat.nodes:
@@ -16,7 +16,7 @@
1616
- match:
1717
$body: |
1818
/^ ip \s+ heap\.percent \s+ ram\.percent \s+ cpu \s+ load_1m \s+ load_5m \s+ load_15m \s+ node\.role \s+ master \s+ name \n
19-
((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmt]{1,5}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
19+
((\d{1,3}\.){3}\d{1,3} \s+ \d+ \s+ \d* \s+ (-)?\d* \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ ((-)?\d*(\.\d+)?)? \s+ (-|[dilmrt]{1,6}) \s+ [-*x] \s+ (\S+\s?)+ \n)+ $/
2020
2121
- do:
2222
cat.nodes:

server/src/main/java/org/elasticsearch/cluster/node/DiscoveryNode.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public static boolean isIngestNode(Settings settings) {
7373
return Node.NODE_INGEST_SETTING.get(settings);
7474
}
7575

76+
public static boolean isRemoteClusterClient(final Settings settings) {
77+
return Node.NODE_REMOTE_CLUSTER_CLIENT.get(settings);
78+
}
79+
7680
private final String nodeName;
7781
private final String nodeId;
7882
private final String ephemeralId;
@@ -281,7 +285,7 @@ public void writeTo(StreamOutput out) throws IOException {
281285
} else {
282286
// an old node will only understand legacy roles since pluggable roles is a new concept
283287
final List<DiscoveryNodeRole> rolesToWrite =
284-
roles.stream().filter(DiscoveryNodeRole.BUILT_IN_ROLES::contains).collect(Collectors.toUnmodifiableList());
288+
roles.stream().filter(DiscoveryNodeRole.LEGACY_ROLES::contains).collect(Collectors.toUnmodifiableList());
285289
out.writeVInt(rolesToWrite.size());
286290
for (final DiscoveryNodeRole role : rolesToWrite) {
287291
if (role == DiscoveryNodeRole.MASTER_ROLE) {
@@ -356,6 +360,15 @@ public boolean isIngestNode() {
356360
return roles.contains(DiscoveryNodeRole.INGEST_ROLE);
357361
}
358362

363+
/**
364+
* Returns whether or not the node can be a remote cluster client.
365+
*
366+
* @return true if the node can be a remote cluster client, false otherwise
367+
*/
368+
public boolean isRemoteClusterClient() {
369+
return roles.contains(DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE);
370+
}
371+
359372
/**
360373
* Returns a set of all the roles that the node fulfills.
361374
* If the node doesn't have any specific role, the set is returned empty, which means that the node is a coordinating only node.

server/src/main/java/org/elasticsearch/cluster/node/DiscoveryNodeRole.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,21 @@ protected Setting<Boolean> roleSetting() {
134134

135135
};
136136

137+
public static final DiscoveryNodeRole REMOTE_CLUSTER_CLIENT_ROLE = new DiscoveryNodeRole("remote_cluster_client", "r") {
138+
139+
@Override
140+
protected Setting<Boolean> roleSetting() {
141+
return Node.NODE_REMOTE_CLUSTER_CLIENT;
142+
}
143+
144+
};
145+
137146
/**
138147
* The built-in node roles.
139148
*/
140-
public static Set<DiscoveryNodeRole> BUILT_IN_ROLES = Set.of(DATA_ROLE, INGEST_ROLE, MASTER_ROLE);
149+
public static Set<DiscoveryNodeRole> BUILT_IN_ROLES = Set.of(DATA_ROLE, INGEST_ROLE, MASTER_ROLE, REMOTE_CLUSTER_CLIENT_ROLE);
150+
151+
static Set<DiscoveryNodeRole> LEGACY_ROLES = Set.of(DATA_ROLE, INGEST_ROLE, MASTER_ROLE);
141152

142153
/**
143154
* Represents an unknown role. This can occur if a newer version adds a role that an older version does not know about, or a newer

server/src/main/java/org/elasticsearch/common/settings/ClusterSettings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ public void apply(Settings value, Settings current, Settings previous) {
402402
Node.NODE_DATA_SETTING,
403403
Node.NODE_MASTER_SETTING,
404404
Node.NODE_INGEST_SETTING,
405+
Node.NODE_REMOTE_CLUSTER_CLIENT,
405406
Node.NODE_ATTRIBUTES,
406407
Node.NODE_LOCAL_STORAGE_SETTING,
407408
AutoCreateIndex.AUTO_CREATE_INDEX_SETTING,

0 commit comments

Comments
 (0)