Received a cluster state from a different master than the current one rejecting received current – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.15

Briefly, this error occurs when there is a mismatch between the master nodes in an Elasticsearch cluster. This can happen due to network issues, or when a new master is elected while the old one is still active. To resolve this, ensure that all nodes have the correct master node information. You can also try restarting the nodes to force a new master election. Additionally, check your network settings to prevent split-brain scenarios, where two nodes believe they are the master.

This guide will help you check for common problems that cause the log ” received a cluster state from a different master than the current one; rejecting (received {}; current {}) ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: cluster, discovery, master.

Log Context

Log “received a cluster state from a different master than the current one; rejecting (received {}; current {})” classname is ZenDiscovery.java.
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

    public static void validateStateIsFromCurrentMaster(Logger logger; DiscoveryNodes currentNodes; ClusterState newClusterState) {
        if (currentNodes.getMasterNodeId() == null) {
            return;
        }
        if (currentNodes.getMasterNodeId().equals(newClusterState.nodes().getMasterNodeId()) == false) {
            logger.warn("received a cluster state from a different master than the current one; rejecting (received {}; current {})";
                newClusterState.nodes().getMasterNode(); currentNodes.getMasterNode());
            throw new IllegalStateException("cluster state from a different master than the current one; rejecting (received " +
                newClusterState.nodes().getMasterNode() + "; current " + currentNodes.getMasterNode() + ")");
        }
    }

 

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?