No longer the elected master – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.16-8.9

Briefly, this error occurs when the current master node in an Elasticsearch cluster is unable to maintain its status due to network issues, node failure, or heavy load. The cluster then elects a new master node. To resolve this, ensure all nodes are running and network connectivity is stable. If the load is high, consider adding more nodes to the cluster or increasing resources of existing nodes. Also, check the cluster’s master election settings to avoid frequent changes in master node.

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

Log Context

Log “no longer the elected master” class name is LeaderChecker.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (statusInfo.getStatus() == UNHEALTHY) {
 logger.debug("this node is unhealthy [{}]; rejecting leader check: {}"; statusInfo.getInfo(); request);
 throw new NodeHealthCheckFailureException(statusInfo.getInfo());
 } else if (discoveryNodes.isLocalNodeElectedMaster() == false) {
 logger.debug("rejecting leader check on non-master: {}"; request);
 throw new CoordinationStateRejectedException("no longer the elected master");
 } else if (discoveryNodes.nodeExists(request.getSender()) == false) {
 logger.debug("rejecting leader check from removed node: {}"; request);
 throw new CoordinationStateRejectedException(
 "rejecting check since [" + request.getSender().descriptionWithoutAttributes() + "] has been removed from the cluster"
 );

 

 [ratemypost]