java.lang.Object
org.elasticsearch.transport.RemoteClusterAware
org.elasticsearch.transport.RemoteClusterService
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ReportingService<RemoteClusterServerInfo>
public final class RemoteClusterService
extends RemoteClusterAware
implements Closeable, ReportingService<RemoteClusterServerInfo>
Basic service for accessing remote clusters via gateway nodes
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.node.ReportingService
ReportingService.Info
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Setting.AffixSetting<Compression.Enabled>
static final Setting.AffixSetting<Compression.Scheme>
static final Setting.AffixSetting<SecureString>
static final String
static final Setting.AffixSetting<TimeValue>
static final Setting.AffixSetting<Boolean>
The initial connect timeout for remote cluster connectionsThe name of a node attribute to select nodes that should be connected to in the remote cluster.Fields inherited from class org.elasticsearch.transport.RemoteClusterAware
LOCAL_CLUSTER_GROUP_KEY, REMOTE_CLUSTER_INDEX_SEPARATOR, settings
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
collectNodes
(Set<String> clusters, ActionListener<BiFunction<String, String, DiscoveryNode>> listener) Collects all nodes of the given clusters and returns / passes a (clusterAlias, nodeId) toDiscoveryNode
function on success.getConnection
(String cluster) getConnection
(DiscoveryNode node, String cluster) Returns a connection to the given node on the given remote clusterReturns the registered remote cluster names.getRemoteClusterClient
(ThreadPool threadPool, String clusterAlias, Executor responseExecutor) Returns a client to the remote cluster if the given cluster alias exists.getRemoteClusterClient
(ThreadPool threadPool, String clusterAlias, Executor responseExecutor, boolean ensureConnected) Returns a client to the remote cluster if the given cluster alias exists.groupIndices
(IndicesOptions indicesOptions, String[] indices) info()
boolean
Returnstrue
if at least one remote cluster is configuredboolean
boolean
boolean
isSkipUnavailable
(String clusterAlias) Returns whether the cluster identified by the provided alias is configured to be skipped when unavailablevoid
listenForUpdates
(ClusterSettings clusterSettings) Registers this instance to listen to updates on the cluster settings.void
maybeEnsureConnectedAndGetConnection
(String clusterAlias, boolean ensureConnected, ActionListener<Transport.Connection> listener) UnlikegetConnection(String)
this method might attempt to re-establish a remote connection if there is no connection available before returning a connection to the remote cluster.protected void
updateRemoteCluster
(String clusterAlias, Settings settings) Subclasses must implement this to receive information about updated cluster aliases.Methods inherited from class org.elasticsearch.transport.RemoteClusterAware
buildRemoteIndexName, getEnabledRemoteClusters, groupClusterIndices
-
Field Details
-
REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
The initial connect timeout for remote cluster connections -
REMOTE_NODE_ATTRIBUTE
The name of a node attribute to select nodes that should be connected to in the remote cluster. For instance a node can be configured withnode.attr.gateway: true
in order to be eligible as a gateway node between clusters. In that casecluster.remote.node.attr: gateway
can be used to filter out other nodes in the remote cluster. The value of the setting is expected to be a boolean,true
for nodes that can become gateways,false
otherwise. -
REMOTE_CLUSTER_SKIP_UNAVAILABLE
-
REMOTE_CLUSTER_PING_SCHEDULE
-
REMOTE_CLUSTER_COMPRESS
-
REMOTE_CLUSTER_COMPRESSION_SCHEME
-
REMOTE_CLUSTER_CREDENTIALS
-
REMOTE_CLUSTER_HANDSHAKE_ACTION_NAME
- See Also:
-
-
Method Details
-
isEnabled
public boolean isEnabled() -
isRemoteClusterServerEnabled
public boolean isRemoteClusterServerEnabled() -
getLocalNode
-
isCrossClusterSearchEnabled
public boolean isCrossClusterSearchEnabled()Returnstrue
if at least one remote cluster is configured -
groupIndices
-
getRegisteredRemoteClusterNames
Returns the registered remote cluster names. -
getConnection
Returns a connection to the given node on the given remote cluster- Throws:
IllegalArgumentException
- if the remote cluster is unknown
-
getConnection
-
maybeEnsureConnectedAndGetConnection
public void maybeEnsureConnectedAndGetConnection(String clusterAlias, boolean ensureConnected, ActionListener<Transport.Connection> listener) UnlikegetConnection(String)
this method might attempt to re-establish a remote connection if there is no connection available before returning a connection to the remote cluster.- Parameters:
clusterAlias
- the remote clusterensureConnected
- whether requests should wait for a connection attempt when there isn't available connectionlistener
- a listener that will be notified the connection or failure
-
listenForUpdates
Description copied from class:RemoteClusterAware
Registers this instance to listen to updates on the cluster settings.- Overrides:
listenForUpdates
in classRemoteClusterAware
-
updateRemoteCluster
Description copied from class:RemoteClusterAware
Subclasses must implement this to receive information about updated cluster aliases.- Specified by:
updateRemoteCluster
in classRemoteClusterAware
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getRemoteConnectionInfos
-
info
- Specified by:
info
in interfaceReportingService<RemoteClusterServerInfo>
-
collectNodes
public void collectNodes(Set<String> clusters, ActionListener<BiFunction<String, String, DiscoveryNode>> listener) Collects all nodes of the given clusters and returns / passes a (clusterAlias, nodeId) toDiscoveryNode
function on success. -
getRemoteClusterClient
public Client getRemoteClusterClient(ThreadPool threadPool, String clusterAlias, Executor responseExecutor, boolean ensureConnected) Returns a client to the remote cluster if the given cluster alias exists.- Parameters:
threadPool
- theThreadPool
for the clientclusterAlias
- the cluster alias the remote cluster is registered underresponseExecutor
- the executor to use to process the responseensureConnected
- whether requests should wait for a connection attempt when there isn't a connection available- Throws:
IllegalArgumentException
- if the given clusterAlias doesn't exist
-
getRemoteClusterClient
public Client getRemoteClusterClient(ThreadPool threadPool, String clusterAlias, Executor responseExecutor) Returns a client to the remote cluster if the given cluster alias exists.- Parameters:
threadPool
- theThreadPool
for the clientclusterAlias
- the cluster alias the remote cluster is registered underresponseExecutor
- the executor to use to process the response- Throws:
IllegalArgumentException
- if the given clusterAlias doesn't exist
-