Skip to content

Commit 381d758

Browse files
authored
Introduce formal role for remote cluster client (#54138)
This commit introduce a formal role for identifying nodes that are capable of making connections to remote clusters. Relates #53924
1 parent 75e80e2 commit 381d758

File tree

33 files changed

+206
-107
lines changed

33 files changed

+206
-107
lines changed

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

+2-2
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_7_7.asciidoc

+16-8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ pre-7.7 default behaviour by adjusting your <<logging>>.
3636
[[breaking_77_settings_changes]]
3737
=== Settings changes
3838

39+
[discrete]
40+
[[deprecate-listener-thread-pool]]
41+
==== `thread_pool.listener.size` and `thread_pool.listener.queue_size` have been deprecated
42+
The listener thread pool is no longer used internally by Elasticsearch.
43+
Therefore, these settings have been deprecated. You can safely remove these
44+
settings from the configuration of your nodes.
45+
46+
[discrete]
47+
[[deprecate-cluster-remote-connect]]
48+
==== `cluster.remote.connect` is deprecated in favor of `node.remote_cluster_client`
49+
Previously the setting `cluster.remote.connect` was used to configure whether or
50+
not the local node is capable of acting as a remote cluster client in
51+
cross-cluster search and cross-cluster replication. This setting is deprecated
52+
in favor of `node.remote_cluster_client` serves the same purpose and identifies
53+
the local node as having the `remote_cluster_client` role.
54+
3955
[discrete]
4056
[[deprecate-missing-realm-order]]
4157
==== Authentication realm `order` will be a required config in version 8.0.0.
@@ -72,14 +88,6 @@ for `gt` and `lte` boundaries, the same queries on `date_range` fields didn't
7288
do this. The behavior is now the same for both field types like documented in
7389
<<range-query-date-math-rounding>>.
7490

75-
[float]
76-
[[deprecate-listener-thread-pool]]
77-
==== `thread_pool.listener.size` and `thread_pool.listener.queue_size` have been deprecated
78-
79-
The listener thread pool is no longer used internally by Elasticsearch.
80-
Therefore, these settings have been deprecated. You can safely remove these
81-
settings from the configuration of your nodes.
82-
8391
[discrete]
8492
[[breaking_77_highlighters_changes]]
8593
=== Highlighters changes

docs/reference/ml/ml-shared.asciidoc

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

803803
--
804804
end::indices[]

docs/reference/modules/node.asciidoc

+23-23
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

+4-4
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

+2-2
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

+2-2
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

+14-1
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;
@@ -282,7 +286,7 @@ public void writeTo(StreamOutput out) throws IOException {
282286
} else {
283287
// an old node will only understand legacy roles since pluggable roles is a new concept
284288
final List<DiscoveryNodeRole> rolesToWrite =
285-
roles.stream().filter(DiscoveryNodeRole.BUILT_IN_ROLES::contains).collect(Collectors.toList());
289+
roles.stream().filter(DiscoveryNodeRole.LEGACY_ROLES::contains).collect(Collectors.toList());
286290
out.writeVInt(rolesToWrite.size());
287291
for (final DiscoveryNodeRole role : rolesToWrite) {
288292
if (role == DiscoveryNodeRole.MASTER_ROLE) {
@@ -357,6 +361,15 @@ public boolean isIngestNode() {
357361
return roles.contains(DiscoveryNodeRole.INGEST_ROLE);
358362
}
359363

364+
/**
365+
* Returns whether or not the node can be a remote cluster client.
366+
*
367+
* @return true if the node can be a remote cluster client, false otherwise
368+
*/
369+
public boolean isRemoteClusterClient() {
370+
return roles.contains(DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE);
371+
}
372+
360373
/**
361374
* Returns a set of all the roles that the node fulfills.
362375
* 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

+13-1
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,23 @@ protected Setting<Boolean> roleSetting() {
137137

138138
};
139139

140+
public static final DiscoveryNodeRole REMOTE_CLUSTER_CLIENT_ROLE = new DiscoveryNodeRole("remote_cluster_client", "r") {
141+
142+
@Override
143+
protected Setting<Boolean> roleSetting() {
144+
return Node.NODE_REMOTE_CLUSTER_CLIENT;
145+
}
146+
147+
};
148+
140149
/**
141150
* The built-in node roles.
142151
*/
143152
public static Set<DiscoveryNodeRole> BUILT_IN_ROLES =
144-
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(DATA_ROLE, INGEST_ROLE, MASTER_ROLE)));
153+
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(DATA_ROLE, INGEST_ROLE, MASTER_ROLE, REMOTE_CLUSTER_CLIENT_ROLE)));
154+
155+
static Set<DiscoveryNodeRole> LEGACY_ROLES =
156+
Collections.unmodifiableSet(new HashSet<>(Arrays.asList(DATA_ROLE, INGEST_ROLE, MASTER_ROLE)));
145157

146158
/**
147159
* 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

+1
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ public void apply(Settings value, Settings current, Settings previous) {
462462
Node.NODE_DATA_SETTING,
463463
Node.NODE_MASTER_SETTING,
464464
Node.NODE_INGEST_SETTING,
465+
Node.NODE_REMOTE_CLUSTER_CLIENT,
465466
Node.NODE_ATTRIBUTES,
466467
Node.NODE_LOCAL_STORAGE_SETTING,
467468
AutoCreateIndex.AUTO_CREATE_INDEX_SETTING,

server/src/main/java/org/elasticsearch/common/unit/ByteSizeValue.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import org.elasticsearch.common.io.stream.Writeable;
2929
import org.elasticsearch.common.logging.DeprecationLogger;
3030
import org.elasticsearch.common.logging.LogConfigurator;
31-
import org.elasticsearch.common.settings.Setting;
3231
import org.elasticsearch.common.xcontent.ToXContentFragment;
3332
import org.elasticsearch.common.xcontent.XContentBuilder;
3433

@@ -41,7 +40,7 @@ public class ByteSizeValue implements Writeable, Comparable<ByteSizeValue>, ToXC
4140
/**
4241
* We have to lazy initialize the deprecation logger as otherwise a static logger here would be constructed before logging is configured
4342
* leading to a runtime failure (see {@link LogConfigurator#checkErrorListener()} ). The premature construction would come from any
44-
* {@link Setting} object constructed in, for example, settings in {@link org.elasticsearch.common.network.NetworkService}.
43+
* {@link ByteSizeValue} object constructed in, for example, settings in {@link org.elasticsearch.common.network.NetworkService}.
4544
*/
4645
static class DeprecationLoggerHolder {
4746
static DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(ByteSizeValue.class));

server/src/main/java/org/elasticsearch/node/Node.java

+3
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
import org.elasticsearch.tasks.TaskResultsService;
159159
import org.elasticsearch.threadpool.ExecutorBuilder;
160160
import org.elasticsearch.threadpool.ThreadPool;
161+
import org.elasticsearch.transport.RemoteClusterService;
161162
import org.elasticsearch.transport.Transport;
162163
import org.elasticsearch.transport.TransportInterceptor;
163164
import org.elasticsearch.transport.TransportService;
@@ -203,6 +204,8 @@ public class Node implements Closeable {
203204
Setting.boolSetting("node.master", true, Property.NodeScope);
204205
public static final Setting<Boolean> NODE_INGEST_SETTING =
205206
Setting.boolSetting("node.ingest", true, Property.NodeScope);
207+
public static final Setting<Boolean> NODE_REMOTE_CLUSTER_CLIENT =
208+
Setting.boolSetting("node.remote_cluster_client", RemoteClusterService.ENABLE_REMOTE_CLUSTERS, Property.NodeScope);
206209

207210
/**
208211
* controls whether the node is allowed to persist things like metadata to disk

0 commit comments

Comments
 (0)