Non-leader rejecting leader check – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7-7.4

Briefly, this error occurs when a non-leader node in an Elasticsearch cluster rejects a leader check. This usually happens due to network issues, causing the non-leader node to be unable to communicate with the leader node. To resolve this issue, you can try the following: 1) Check and fix any network connectivity issues. 2) Ensure that all nodes in the cluster are running the same version of Elasticsearch. 3) Check the cluster’s health and status using Elasticsearch’s APIs. 4) If necessary, restart the nodes or the entire cluster.

This guide will help you check for common problems that cause the log ” non-leader rejecting leader check ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: cluster.

Log Context

Log “non-leader rejecting leader check” class name is LeaderChecker.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 final DiscoveryNodes discoveryNodes = this.discoveryNodes;
 assert discoveryNodes != null;  if (discoveryNodes.isLocalNodeElectedMaster() == false) {
 logger.debug("non-master handling {}"; request);
 throw new CoordinationStateRejectedException("non-leader rejecting leader check");
 } else if (discoveryNodes.nodeExists(request.getSender()) == false) {
 logger.debug("leader check from unknown node: {}"; request);
 throw new CoordinationStateRejectedException("leader check from unknown node");
 } else {
 logger.trace("handling {}"; request);

 

 [ratemypost]