Package org.elasticsearch.transport
Class RemoteClusterService
- java.lang.Object
-
- org.elasticsearch.transport.RemoteClusterAware
-
- org.elasticsearch.transport.RemoteClusterService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class RemoteClusterService extends RemoteClusterAware implements java.io.Closeable
Basic service for accessing remote clusters via gateway nodes
-
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Boolean>
ENABLE_REMOTE_CLUSTERS
Iftrue
connecting to remote clusters is supported on this node.static Setting.AffixSetting<java.lang.Boolean>
REMOTE_CLUSTER_COMPRESS
static Setting.AffixSetting<TimeValue>
REMOTE_CLUSTER_PING_SCHEDULE
static Setting.AffixSetting<java.lang.Boolean>
REMOTE_CLUSTER_SKIP_UNAVAILABLE
static Setting<java.lang.Integer>
REMOTE_CONNECTIONS_PER_CLUSTER
The maximum number of connections that will be established to a remote cluster.static Setting<TimeValue>
REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
The initial connect timeout for remote cluster connectionsstatic Setting<java.lang.String>
REMOTE_NODE_ATTRIBUTE
The name of a node attribute to select nodes that should be connected to in the remote cluster.static Setting<java.lang.Boolean>
SEARCH_ENABLE_REMOTE_CLUSTERS
static Setting.AffixSetting<java.lang.Boolean>
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE
static SettingUpgrader<java.lang.Boolean>
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER
static Setting<java.lang.Integer>
SEARCH_REMOTE_CONNECTIONS_PER_CLUSTER
static Setting<TimeValue>
SEARCH_REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
static Setting<java.lang.String>
SEARCH_REMOTE_NODE_ATTRIBUTE
-
Fields inherited from class org.elasticsearch.transport.RemoteClusterAware
LOCAL_CLUSTER_GROUP_KEY, REMOTE_CLUSTER_INDEX_SEPARATOR, REMOTE_CLUSTERS_PROXY, REMOTE_CLUSTERS_SEEDS, SEARCH_REMOTE_CLUSTER_SEEDS_UPGRADER, SEARCH_REMOTE_CLUSTERS_PROXY, SEARCH_REMOTE_CLUSTERS_PROXY_UPGRADER, SEARCH_REMOTE_CLUSTERS_SEEDS, settings
-
-
Method Summary
Modifier and Type Method Description void
close()
void
collectNodes(java.util.Set<java.lang.String> clusters, ActionListener<java.util.function.BiFunction<java.lang.String,java.lang.String,DiscoveryNode>> listener)
Collects all nodes of the given clusters and returns / passes a (clusterAlias, nodeId) toDiscoveryNode
function on success.void
collectSearchShards(IndicesOptions indicesOptions, java.lang.String preference, java.lang.String routing, java.util.Map<java.lang.String,OriginalIndices> remoteIndicesByCluster, ActionListener<java.util.Map<java.lang.String,ClusterSearchShardsResponse>> listener)
Transport.Connection
getConnection(java.lang.String cluster)
Transport.Connection
getConnection(DiscoveryNode node, java.lang.String cluster)
Returns a connection to the given node on the given remote clusterjava.util.Set<java.lang.String>
getRegisteredRemoteClusterNames()
Returns the registered remote cluster names.Client
getRemoteClusterClient(ThreadPool threadPool, java.lang.String clusterAlias)
Returns a client to the remote cluster if the given cluster alias exists.void
getRemoteConnectionInfos(ActionListener<java.util.Collection<RemoteConnectionInfo>> listener)
java.util.Map<java.lang.String,OriginalIndices>
groupIndices(IndicesOptions indicesOptions, java.lang.String[] indices, java.util.function.Predicate<java.lang.String> indexExists)
boolean
isCrossClusterSearchEnabled()
Returnstrue
if at least one remote cluster is configuredvoid
listenForUpdates(ClusterSettings clusterSettings)
Registers this instance to listen to updates on the cluster settings.protected void
updateRemoteCluster(java.lang.String clusterAlias, java.util.List<java.lang.String> addresses, java.lang.String proxyAddress, boolean compressionEnabled, TimeValue pingSchedule)
Subclasses must implement this to receive information about updated cluster aliases.-
Methods inherited from class org.elasticsearch.transport.RemoteClusterAware
buildRemoteClustersDynamicConfig, buildRemoteIndexName, groupClusterIndices, parseHostPort
-
-
-
-
Field Detail
-
SEARCH_REMOTE_CONNECTIONS_PER_CLUSTER
public static final Setting<java.lang.Integer> SEARCH_REMOTE_CONNECTIONS_PER_CLUSTER
-
REMOTE_CONNECTIONS_PER_CLUSTER
public static final Setting<java.lang.Integer> REMOTE_CONNECTIONS_PER_CLUSTER
The maximum number of connections that will be established to a remote cluster. For instance if there is only a single seed node, other nodes will be discovered up to the given number of nodes in this setting. The default is 3.
-
SEARCH_REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
public static final Setting<TimeValue> SEARCH_REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
-
REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
public static final Setting<TimeValue> REMOTE_INITIAL_CONNECTION_TIMEOUT_SETTING
The initial connect timeout for remote cluster connections
-
SEARCH_REMOTE_NODE_ATTRIBUTE
public static final Setting<java.lang.String> SEARCH_REMOTE_NODE_ATTRIBUTE
-
REMOTE_NODE_ATTRIBUTE
public static final Setting<java.lang.String> 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 casesearch.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.
-
SEARCH_ENABLE_REMOTE_CLUSTERS
public static final Setting<java.lang.Boolean> SEARCH_ENABLE_REMOTE_CLUSTERS
-
ENABLE_REMOTE_CLUSTERS
public static final Setting<java.lang.Boolean> ENABLE_REMOTE_CLUSTERS
Iftrue
connecting to remote clusters is supported on this node. Iffalse
this node will not establish connections to any remote clusters configured. Search requests executed against this node (where this node is the coordinating node) will fail if remote cluster syntax is used as an index pattern. The default istrue
-
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE
public static final Setting.AffixSetting<java.lang.Boolean> SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE
-
SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER
public static final SettingUpgrader<java.lang.Boolean> SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER
-
REMOTE_CLUSTER_SKIP_UNAVAILABLE
public static final Setting.AffixSetting<java.lang.Boolean> REMOTE_CLUSTER_SKIP_UNAVAILABLE
-
REMOTE_CLUSTER_PING_SCHEDULE
public static final Setting.AffixSetting<TimeValue> REMOTE_CLUSTER_PING_SCHEDULE
-
REMOTE_CLUSTER_COMPRESS
public static final Setting.AffixSetting<java.lang.Boolean> REMOTE_CLUSTER_COMPRESS
-
-
Method Detail
-
isCrossClusterSearchEnabled
public boolean isCrossClusterSearchEnabled()
Returnstrue
if at least one remote cluster is configured
-
groupIndices
public java.util.Map<java.lang.String,OriginalIndices> groupIndices(IndicesOptions indicesOptions, java.lang.String[] indices, java.util.function.Predicate<java.lang.String> indexExists)
-
getRegisteredRemoteClusterNames
public java.util.Set<java.lang.String> getRegisteredRemoteClusterNames()
Returns the registered remote cluster names.
-
collectSearchShards
public void collectSearchShards(IndicesOptions indicesOptions, java.lang.String preference, java.lang.String routing, java.util.Map<java.lang.String,OriginalIndices> remoteIndicesByCluster, ActionListener<java.util.Map<java.lang.String,ClusterSearchShardsResponse>> listener)
-
getConnection
public Transport.Connection getConnection(DiscoveryNode node, java.lang.String cluster)
Returns a connection to the given node on the given remote cluster- Throws:
java.lang.IllegalArgumentException
- if the remote cluster is unknown
-
getConnection
public Transport.Connection getConnection(java.lang.String cluster)
-
listenForUpdates
public void listenForUpdates(ClusterSettings clusterSettings)
Description copied from class:RemoteClusterAware
Registers this instance to listen to updates on the cluster settings.- Overrides:
listenForUpdates
in classRemoteClusterAware
-
updateRemoteCluster
protected void updateRemoteCluster(java.lang.String clusterAlias, java.util.List<java.lang.String> addresses, java.lang.String proxyAddress, boolean compressionEnabled, TimeValue pingSchedule)
Description copied from class:RemoteClusterAware
Subclasses must implement this to receive information about updated cluster aliases. If the given address list is empty the cluster alias is unregistered and should be removed.- Specified by:
updateRemoteCluster
in classRemoteClusterAware
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
java.io.IOException
-
getRemoteConnectionInfos
public void getRemoteConnectionInfos(ActionListener<java.util.Collection<RemoteConnectionInfo>> listener)
-
collectNodes
public void collectNodes(java.util.Set<java.lang.String> clusters, ActionListener<java.util.function.BiFunction<java.lang.String,java.lang.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, java.lang.String clusterAlias)
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 under- Throws:
java.lang.IllegalArgumentException
- if the given clusterAlias doesn't exist
-
-