Package org.elasticsearch.transport
Class RemoteClusterAware
- java.lang.Object
-
- org.elasticsearch.transport.RemoteClusterAware
-
- Direct Known Subclasses:
RemoteClusterService
public abstract class RemoteClusterAware extends java.lang.Object
Base class for all services and components that need up-to-date information about the registered remote clusters
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LOCAL_CLUSTER_GROUP_KEY
static char
REMOTE_CLUSTER_INDEX_SEPARATOR
static Setting.AffixSetting<java.lang.String>
REMOTE_CLUSTERS_PROXY
A proxy address for the remote cluster.static Setting.AffixSetting<java.util.List<java.lang.String>>
REMOTE_CLUSTERS_SEEDS
A list of initial seed nodes to discover eligible nodes from the remote clusterstatic SettingUpgrader<java.util.List<java.lang.String>>
SEARCH_REMOTE_CLUSTER_SEEDS_UPGRADER
static Setting.AffixSetting<java.lang.String>
SEARCH_REMOTE_CLUSTERS_PROXY
static SettingUpgrader<java.lang.String>
SEARCH_REMOTE_CLUSTERS_PROXY_UPGRADER
static Setting.AffixSetting<java.util.List<java.lang.String>>
SEARCH_REMOTE_CLUSTERS_SEEDS
protected Settings
settings
-
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteClusterAware(Settings settings)
Creates a newRemoteClusterAware
instance
-
Method Summary
Modifier and Type Method Description protected static java.util.Map<java.lang.String,Tuple<java.lang.String,java.util.List<Tuple<java.lang.String,java.util.function.Supplier<DiscoveryNode>>>>>
buildRemoteClustersDynamicConfig(Settings settings)
Builds the dynamic per-cluster config from the given settings.static java.lang.String
buildRemoteIndexName(java.lang.String clusterAlias, java.lang.String indexName)
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>>
groupClusterIndices(java.util.Set<java.lang.String> remoteClusterNames, java.lang.String[] requestIndices, java.util.function.Predicate<java.lang.String> indexExists)
Groups indices per cluster by splitting remote cluster-alias, index-name pairs onREMOTE_CLUSTER_INDEX_SEPARATOR
.void
listenForUpdates(ClusterSettings clusterSettings)
Registers this instance to listen to updates on the cluster settings.static Tuple<java.lang.String,java.lang.Integer>
parseHostPort(java.lang.String remoteHost)
protected abstract void
updateRemoteCluster(java.lang.String clusterAlias, java.util.List<java.lang.String> addresses, java.lang.String proxy, boolean compressionEnabled, TimeValue pingSchedule)
Subclasses must implement this to receive information about updated cluster aliases.
-
-
-
Field Detail
-
SEARCH_REMOTE_CLUSTERS_SEEDS
public static final Setting.AffixSetting<java.util.List<java.lang.String>> SEARCH_REMOTE_CLUSTERS_SEEDS
-
SEARCH_REMOTE_CLUSTER_SEEDS_UPGRADER
public static final SettingUpgrader<java.util.List<java.lang.String>> SEARCH_REMOTE_CLUSTER_SEEDS_UPGRADER
-
REMOTE_CLUSTERS_SEEDS
public static final Setting.AffixSetting<java.util.List<java.lang.String>> REMOTE_CLUSTERS_SEEDS
A list of initial seed nodes to discover eligible nodes from the remote cluster
-
REMOTE_CLUSTER_INDEX_SEPARATOR
public static final char REMOTE_CLUSTER_INDEX_SEPARATOR
- See Also:
- Constant Field Values
-
LOCAL_CLUSTER_GROUP_KEY
public static final java.lang.String LOCAL_CLUSTER_GROUP_KEY
- See Also:
- Constant Field Values
-
SEARCH_REMOTE_CLUSTERS_PROXY
public static final Setting.AffixSetting<java.lang.String> SEARCH_REMOTE_CLUSTERS_PROXY
-
SEARCH_REMOTE_CLUSTERS_PROXY_UPGRADER
public static final SettingUpgrader<java.lang.String> SEARCH_REMOTE_CLUSTERS_PROXY_UPGRADER
-
REMOTE_CLUSTERS_PROXY
public static final Setting.AffixSetting<java.lang.String> REMOTE_CLUSTERS_PROXY
A proxy address for the remote cluster. NOTE: this settings is undocumented until we have at last one transport that supports passing on the hostname via a mechanism like SNI.
-
settings
protected final Settings settings
-
-
Constructor Detail
-
RemoteClusterAware
protected RemoteClusterAware(Settings settings)
Creates a newRemoteClusterAware
instance- Parameters:
settings
- the nodes level settings
-
-
Method Detail
-
buildRemoteClustersDynamicConfig
protected static java.util.Map<java.lang.String,Tuple<java.lang.String,java.util.List<Tuple<java.lang.String,java.util.function.Supplier<DiscoveryNode>>>>> buildRemoteClustersDynamicConfig(Settings settings)
Builds the dynamic per-cluster config from the given settings. This is a map keyed by the cluster alias that points to a tuple (ProxyAddresss, [SeedNodeSuppliers]). If a cluster is configured with a proxy address all seed nodes will point toTransportAddress.META_ADDRESS
and their configured address will be used as the hostname for the generated discovery node.
-
groupClusterIndices
protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> groupClusterIndices(java.util.Set<java.lang.String> remoteClusterNames, java.lang.String[] requestIndices, java.util.function.Predicate<java.lang.String> indexExists)
Groups indices per cluster by splitting remote cluster-alias, index-name pairs onREMOTE_CLUSTER_INDEX_SEPARATOR
. All indices per cluster are collected as a list in the returned map keyed by the cluster alias. Local indices are grouped underLOCAL_CLUSTER_GROUP_KEY
. The returned map is mutable.- Parameters:
remoteClusterNames
- the remote cluster namesrequestIndices
- the indices in the search request to filterindexExists
- a predicate that can test if a certain index or alias exists in the local cluster- Returns:
- a map of grouped remote and local indices
-
updateRemoteCluster
protected abstract void updateRemoteCluster(java.lang.String clusterAlias, java.util.List<java.lang.String> addresses, java.lang.String proxy, boolean compressionEnabled, TimeValue pingSchedule)
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.
-
listenForUpdates
public void listenForUpdates(ClusterSettings clusterSettings)
Registers this instance to listen to updates on the cluster settings.
-
parseHostPort
public static Tuple<java.lang.String,java.lang.Integer> parseHostPort(java.lang.String remoteHost)
-
buildRemoteIndexName
public static java.lang.String buildRemoteIndexName(java.lang.String clusterAlias, java.lang.String indexName)
-
-