How To Solve Issues Related to Log – not enough master nodes discovered during pinging

How To Solve Issues Related to Log – not enough master nodes discovered during pinging

Updated: April-20

Elasticsearch Version: 1.7-8.0

Background

Before you begin reading this guide try our beta Elasticsearch Health Check-Up it analyses JSON’s to provide personalized recommendations that can improve your clusters performance.


To troubleshoot log “not enough master nodes discovered during pinging” it’s important to understand a few problems related to Elasticsearch concepts discovery, master. See bellow important tips and explanations on these concepts

Important Note:- This log is for Elasticsearch versions before 7.X. beginning from 7.X Elasticsearch uses a new cluster coordination technique explained in this official ES blog.

Overview

Before Elasticsearch’s current major version(7.X), Elasticsearch used the Zen discovery module for discovery and cluster formation. This module uses two main configs in production, to create a cluster and elect the master nodes.
 discovery.zen.ping.unicast.hosts: //list of all the nodes participate in the cluster</span><span style="font-weight: 400;" data-mce-style="font-weight: 400;">
</span><span style="font-weight: 400;" data-mce-style="font-weight: 400;">discovery.zen.minimum</span><i><span style="font-weight: 400;" data-mce-style="font-weight: 400;">_master_</span></i><span style="font-weight: 400;" data-mce-style="font-weight: 400;">nodes: //Minimum no of master nodes in your cluster. 

Troubleshooting steps:

  1. A warning log would mention how many master nodes were found and how many are required, for example, the warning log below shows a total of 2 master nodes required and no master nodes found. The number of total master nodes is dependent on the config discovery.zen.minimum_master_nodes.   
     not enough master nodes discovered during pinging (found [[]], but needed [2]), pinging again 
  2. Check how many master nodes are configured in your cluster by default., Eevery node can act as the master node, and you can explicitly disable it using node.master : false in the particular node’s elasticsearch.yml.
  3. The above step helps to determine how many nodes are eligible to become masters, and if this is less than the discovery.zen.minimum_master_nodes, then the cluster won’t able to choose the master node.
  4. Sometimes due to network issues or some other issue, some eligible master nodes are not connected to other nodes and to troubleshoot this, you can enable the TRACE logging by adding the below line in elasticsearch.yml.
 logger.org.elasticsearch.discovery: TRACE 
This gives more information on the cause, like in the sample TRACE log below for Zen discovery, which mentions that another master eligible node is not reachable (as it hadn’t been started)., The IP was mentioned in the discovery.zen.ping.unicast.hosts:
 [</span><span style="font-weight: 400;">2020-03-20T06:35:00,218</span><span style="font-weight: 400;">][</span><span style="font-weight: 400;">TRACE</span><span style="font-weight: 400;">][</span><span style="font-weight: 400;">o.e.d.z.UnicastZenPing </span><span style="font-weight: 400;">] [] [10] failed to ping {#zen</span><i><span style="font-weight: 400;">_unicast_</span></i><span style="font-weight: 400;">172.31.36.118_0#}{BvhuywOqT1qf5Jxwn5zcsw}{172.31.36.118}{172.31.36.118:9300}</span><span style="font-weight: 400;">
</span><span style="font-weight: 400;">org.elasticsearch.transport.ConnectTransportException: [][172.31.36.118:9300] connect_timeout[3s] 

Log Context

Log”Not enough master nodes discovered during pinging (found [{}]; but needed [{}]); pinging again” classname is ZenDiscovery.java
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                 final ElectMasterService.MasterCandidate winner = electMaster.electMaster(masterCandidates);
                logger.trace("candidate {} won election"; winner);
                return winner.getNode();
            } else {
                // if we don't have enough master nodes; we bail; because there are not enough master to elect from
                logger.warn("not enough master nodes discovered during pinging (found [{}]; but needed [{}]); pinging again";
                            masterCandidates; electMaster.minimumMasterNodes());
                return null;
            }
        } else {
            assert !activeMasters.contains(localNode) :




Related issues to this log

We have gathered selected Q&A from the community and issues from Github, that can help fix related issues please review the following for further information :

1 not enough master nodes discovered during pinging – Elasticsearch cluster self signed certificate

0.20 K 

Elasticsearch Not Enough Master Nod  

About Opster

Opster detects root causes of Elasticsearch problems, provides automated recommendations and can perform various actions to prevent issues and optimize performance

Find Configuration Errors

Analyze Now