public interface DiscoveryPlugin
Plugin
s that extends Elasticsearch's discovery functionality. To add an additional
NetworkService.CustomNameResolver
just implement the interface and implement the getCustomNameResolver(Settings)
method:
public class MyDiscoveryPlugin extends Plugin implements DiscoveryPlugin {
@Override
public NetworkService.CustomNameResolver getCustomNameResolver(Settings settings) {
return new YourCustomNameResolverInstance(settings);
}
}
Modifier and Type | Method and Description |
---|---|
default NetworkService.CustomNameResolver |
getCustomNameResolver(Settings settings)
Override to add additional
NetworkService.CustomNameResolver s. |
default java.util.Map<java.lang.String,java.util.function.Supplier<Discovery>> |
getDiscoveryTypes(ThreadPool threadPool,
TransportService transportService,
NamedWriteableRegistry namedWriteableRegistry,
ClusterService clusterService,
UnicastHostsProvider hostsProvider)
Returns custom discovery implementations added by this plugin.
|
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.
|
default java.util.Map<java.lang.String,java.util.function.Supplier<Discovery>> getDiscoveryTypes(ThreadPool threadPool, TransportService transportService, NamedWriteableRegistry namedWriteableRegistry, ClusterService clusterService, UnicastHostsProvider hostsProvider)
DiscoveryModule.DISCOVERY_TYPE_SETTING
, and
the value is a supplier to construct the Discovery
.threadPool
- Use to schedule ping actionstransportService
- Use to communicate with other nodesclusterService
- Use to find current nodes in the clusterhostsProvider
- Use to find configured hosts which should be pinged for initial discoverydefault NetworkService.CustomNameResolver getCustomNameResolver(Settings settings)
NetworkService.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_
default java.util.Map<java.lang.String,java.util.function.Supplier<UnicastHostsProvider>> getZenHostsProviders(TransportService transportService, NetworkService networkService)
DiscoveryModule.DISCOVERY_HOSTS_PROVIDER_SETTING
), and
the value is a supplier to construct the host provider when it is selected for use.transportService
- Use to form the TransportAddress
portion
of a DiscoveryNode
networkService
- Use to find the publish host address of the current node