Interface DiscoveryPlugin


  • public interface DiscoveryPlugin
    An additional extension point for Plugins 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);
         }
     }
     
    • Method Detail

      • getCustomNameResolver

        default NetworkService.CustomNameResolver getCustomNameResolver​(Settings settings)
        Override to add additional NetworkService.CustomNameResolvers. 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_
         
      • getJoinValidator

        default BiConsumer<DiscoveryNode,​ClusterState> getJoinValidator()
        Returns a consumer that validate the initial join cluster state. The validator, unless null is called exactly once per join attempt but might be called multiple times during the lifetime of a node. Validators are expected to throw a IllegalStateException if the node and the cluster-state are incompatible.
      • getElectionStrategies

        default Map<String,​ElectionStrategy> getElectionStrategies()
        Allows plugging in election strategies (see ElectionStrategy) that define a customized notion of an election quorum.