Class RemoteClusterService

java.lang.Object
org.elasticsearch.transport.RemoteClusterAware
org.elasticsearch.transport.RemoteClusterService
All Implemented Interfaces:
Closeable, AutoCloseable

public final class RemoteClusterService extends RemoteClusterAware implements Closeable
Basic service for accessing remote clusters via gateway nodes
  • Field Details

    • 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<String> SEARCH_REMOTE_NODE_ATTRIBUTE
    • REMOTE_NODE_ATTRIBUTE

      public static final Setting<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 with node.attr.gateway: true in order to be eligible as a gateway node between clusters. In that case search.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<Boolean> SEARCH_ENABLE_REMOTE_CLUSTERS
    • ENABLE_REMOTE_CLUSTERS

      public static final Setting<Boolean> ENABLE_REMOTE_CLUSTERS
      If true connecting to remote clusters is supported on this node. If false 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 is true
    • SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE

      public static final Setting.AffixSetting<Boolean> SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE
    • SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER

      public static final SettingUpgrader<Boolean> SEARCH_REMOTE_CLUSTER_SKIP_UNAVAILABLE_UPGRADER
    • REMOTE_CLUSTER_SKIP_UNAVAILABLE

      public static final Setting.AffixSetting<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<Compression.Enabled> REMOTE_CLUSTER_COMPRESS
    • REMOTE_CLUSTER_COMPRESSION_SCHEME

      public static final Setting.AffixSetting<Compression.Scheme> REMOTE_CLUSTER_COMPRESSION_SCHEME
  • Method Details

    • isEnabled

      public boolean isEnabled()
    • getLocalNode

      public DiscoveryNode getLocalNode()
    • isCrossClusterSearchEnabled

      public boolean isCrossClusterSearchEnabled()
      Returns true if at least one remote cluster is configured
    • groupIndices

      public Map<String,OriginalIndices> groupIndices(IndicesOptions indicesOptions, String[] indices, Predicate<String> indexExists)
    • getRegisteredRemoteClusterNames

      public Set<String> getRegisteredRemoteClusterNames()
      Returns the registered remote cluster names.
    • getConnection

      public Transport.Connection getConnection(DiscoveryNode node, String cluster)
      Returns a connection to the given node on the given remote cluster
      Throws:
      IllegalArgumentException - if the remote cluster is unknown
    • isSkipUnavailable

      public boolean isSkipUnavailable(String clusterAlias)
      Returns whether the cluster identified by the provided alias is configured to be skipped when unavailable
    • getConnection

      public Transport.Connection getConnection(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 class RemoteClusterAware
    • updateRemoteCluster

      protected void updateRemoteCluster(String clusterAlias, Settings settings)
      Description copied from class: RemoteClusterAware
      Subclasses must implement this to receive information about updated cluster aliases.
      Specified by:
      updateRemoteCluster in class RemoteClusterAware
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • getRemoteConnectionInfos

      public Stream<RemoteConnectionInfo> getRemoteConnectionInfos()
    • 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) to DiscoveryNode function on success.
    • getRemoteClusterClient

      public Client getRemoteClusterClient(ThreadPool threadPool, String clusterAlias, boolean ensureConnected)
      Returns a client to the remote cluster if the given cluster alias exists.
      Parameters:
      threadPool - the ThreadPool for the client
      clusterAlias - the cluster alias the remote cluster is registered under
      ensureConnected - 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)
      Returns a client to the remote cluster if the given cluster alias exists.
      Parameters:
      threadPool - the ThreadPool for the client
      clusterAlias - the cluster alias the remote cluster is registered under
      Throws:
      IllegalArgumentException - if the given clusterAlias doesn't exist