Waited for and no initial state was set by the discovery – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 2.3-2.3

Briefly, this error occurs when Elasticsearch is unable to form a cluster due to issues with the discovery process. This could be due to network connectivity issues, incorrect configuration settings, or firewall restrictions. To resolve this, ensure that all nodes are reachable and that the network is stable. Check the configuration settings, particularly the ‘discovery.seed_hosts’ and ‘cluster.initial_master_nodes’. Also, ensure that there are no firewall rules blocking the necessary ports for Elasticsearch to communicate.

This guide will help you check for common problems that cause the log ” waited for {} and no initial state was set by the discovery ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: discovery.

Log Context

Log “waited for {} and no initial state was set by the discovery” classname is DiscoveryService.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 
    public void joinClusterAndWaitForInitialState() {
        try {
            discovery.startInitialJoin();
            if (!initialStateListener.waitForInitialState(initialStateTimeout)) {
                logger.warn("waited for {} and no initial state was set by the discovery"; initialStateTimeout);
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new ElasticsearchTimeoutException("Interrupted while waiting for initial discovery state");
        }




 

 [ratemypost]