Using discovery type and host providers – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-6.8

Briefly, this error occurs when Elasticsearch is trying to form a cluster using the specified discovery type and host providers, but it’s encountering issues. This could be due to incorrect configuration settings or network connectivity problems. To resolve this, ensure that the discovery settings in your Elasticsearch configuration file are correct. Also, check your network connectivity to ensure that all nodes can communicate with each other. If you’re using cloud-based host providers, ensure that the correct credentials and endpoints are provided.

Before you begin reading about how to correct this error, we recommend you run the Elasticsearch Error Check-Up which can help you resolve it and prevent future errors from occurring.

This guide will help you check for common problems that cause the log “using discovery type and host providers” to appear. It’s important to understand the issues related to it, so to get started, read the general overview on common issues and tips related to discovery in Elasticsearch.

Background

Discovery and cluster formation is affected by several settings. discovery.type is one such setting. This setting is used to specify if Elasticsearch should form a multi-node cluster or not. If you intend to run Elasticsearch on a single-node, then you need to specify this setting in elasticsearch.yml. 

By default, Elasticsearch allows the nodes to join the cluster (if other nodes are discovered while forming the cluster), hence, forming a multi-node cluster.

How to reproduce this log

Add the below config in elasticsearch.yml.

http.port: 9200
discovery.type: single-node

Then start Elasticsearch from the command line as follows:

./bin/elasticsearch

The following logs are generated:

[INFO ][o.e.d.DiscoveryModule    ] using discovery type [single-node] and seed hosts providers [settings]
[INFO ][o.e.n.Node               ] initialized

What this error means

This log message is an INFO message that a single-node Elasticsearch cluster has been started for development or testing. This is enabled by using discovery.type: single-node in elasticsearch.yml. 

The seed host providers provide a list of the addresses of the master-eligible nodes in the cluster. Both these settings affect the cluster and discovery formation. 

Based on your discovery type settings you will see the log lines.To know more about these settings, refer to this official documentation.

Log Context

Log “using discovery type [{}] and host providers {}” classname is DiscoveryModule.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

        String discoveryType = DISCOVERY_TYPE_SETTING.get(settings);
        Supplier discoverySupplier = discoveryTypes.get(discoveryType);
        if (discoverySupplier == null) {
            throw new IllegalArgumentException("Unknown discovery type [" + discoveryType + "]");
        }
        logger.info("using discovery type [{}] and host providers {}"; discoveryType; hostsProviderNames);
        discovery = Objects.requireNonNull(discoverySupplier.get());
    }

    public Discovery getDiscovery() {
        return discovery;

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?