Package org.elasticsearch.plugins
Interface DiscoveryPlugin
-
public interface DiscoveryPlugin
An additional extension point forPlugin
s that extends Elasticsearch's discovery functionality. To add an additionalNetworkService.CustomNameResolver
just implement the interface and implement thegetCustomNameResolver(Settings)
method:public class MyDiscoveryPlugin extends Plugin implements DiscoveryPlugin { @Override public NetworkService.CustomNameResolver getCustomNameResolver(Settings settings) { return new YourCustomNameResolverInstance(settings); } }
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default NetworkService.CustomNameResolver
getCustomNameResolver(Settings settings)
Override to add additionalNetworkService.CustomNameResolver
s.default java.util.Map<java.lang.String,java.util.function.Supplier<Discovery>>
getDiscoveryTypes(ThreadPool threadPool, TransportService transportService, NamedWriteableRegistry namedWriteableRegistry, MasterService masterService, ClusterApplier clusterApplier, ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider, AllocationService allocationService)
Returns custom discovery implementations added by this plugin.default java.util.function.BiConsumer<DiscoveryNode,ClusterState>
getJoinValidator()
Returns a consumer that validate the initial join cluster state.default java.util.Map<java.lang.String,java.util.function.Supplier<UnicastHostsProvider>>
getZenHostsProviders(TransportService transportService, NetworkService networkService)
Returns providers of unicast host lists for zen discovery.
-
-
-
Method Detail
-
getDiscoveryTypes
default java.util.Map<java.lang.String,java.util.function.Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService, NamedWriteableRegistry namedWriteableRegistry, MasterService masterService, ClusterApplier clusterApplier, ClusterSettings clusterSettings, UnicastHostsProvider hostsProvider, AllocationService allocationService)
Returns custom discovery implementations added by this plugin. The key of the returned map is the name of the discovery implementation (seeDiscoveryModule.DISCOVERY_TYPE_SETTING
, and the value is a supplier to construct theDiscovery
.- Parameters:
threadPool
- Use to schedule ping actionstransportService
- Use to communicate with other nodesmasterService
- Use to submit cluster state update tasksclusterApplier
- Use to locally apply cluster state updatesclusterSettings
- Use to get cluster settingshostsProvider
- Use to find configured hosts which should be pinged for initial discovery
-
getCustomNameResolver
default NetworkService.CustomNameResolver getCustomNameResolver(Settings settings)
Override to add additionalNetworkService.CustomNameResolver
s. This can be handy if you want to provide your own Network interface name like _mycard_ and implement by yourself the logic to get an actual IP address/hostname based on this name. For example: you could call a third party service (an API) to resolve _mycard_. Then you could define in elasticsearch.yml settings like:network.host: _mycard_
-
getZenHostsProviders
default java.util.Map<java.lang.String,java.util.function.Supplier<UnicastHostsProvider>> getZenHostsProviders(TransportService transportService, NetworkService networkService)
Returns providers of unicast host lists for zen discovery. The key of the returned map is the name of the host provider (seeDiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING
), and the value is a supplier to construct the host provider when it is selected for use.- Parameters:
transportService
- Use to form theTransportAddress
portion of aDiscoveryNode
networkService
- Use to find the publish host address of the current node
-
getJoinValidator
default java.util.function.BiConsumer<DiscoveryNode,ClusterState> getJoinValidator()
Returns a consumer that validate the initial join cluster state. The validator, unlessnull
is called exactly once per join attempt but might be called multiple times during the lifetime of a node. Validators are expected to throw aIllegalStateException
if the node and the cluster-state are incompatible.
-
-