Master not discovered or elected yet, an election requires 2 nodes with ids

**config file **

version: '2.2'
services:
  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.10.2
    container_name: es03
    environment:
      - node.name=es03
      - network.publish_host=192.168.61.114
      - discovery.seed_hosts=192.168.61.112
      - cluster.initial_master_nodes=192.168.61.112,192.168.61.113,192.168.61.114
      - cluster.name=es-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - elastic
volumes:
  data01:
    driver: local
networks:
  elastic:
    driver: bridge

error log

master not discovered or elected yet, an election requires 2 nodes with ids

[QhLl9zbgQt6mQku_yLTqNw, ru42fueKTYWDuaUhgGkXuQ],

have discovered

[{es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}
{192.168.61.114}{192.168.61.114:9300}
{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20},

{es01}
{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}
{192.168.61.112}{192.168.61.112:9300}
{cdhilmrstw}{ml.machine_memory=2933927936, ml.max_open_jobs=20, xpack.installed=true, transform.node=true},

{es02}
{mRFp_9x1T4ea_2KHEUzdyQ}{fT8zs_b-SrSRi4Zvum4q0Q}
{192.168.61.113}{192.168.61.113:9300}
{cdhilmrstw}{ml.machine_memory=2933932032, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}]

which is a quorum; discovery will continue using

[192.168.61.112:9300, 192.168.61.113:9300]

from hosts providers and

[{es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}
{192.168.61.114}{192.168.61.114:9300}
{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}]

from last-known cluster state; node term 0, last-accepted version 0 in term 0

Please don't post images of text, they are impossible to search for later and cannot be read by those of us using screen readers (and tbh this one is almost impossible to read even for sighted readers). Instead please share the contents of the logs and config files, formatted using the </> button so it looks as you are seeing it.

Is that ok? I tried my best

It's better, though not perfect. At least I can see it now. Use the </> button and check the preview window:

preformatted text

I don't think this message is what Elasticsearch reported, I think you've edited it and now it doesn't make sense. Would you share the actual logs that Elasticsearch reports without editing?

this is the log

es01 | {"type": "server", "timestamp": "2021-01-26T09:34:34,972Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "es-cluster", "node.name": "es01", "message": "master not discovered or elected yet, an election requires at least 2 nodes with ids from [bYUUn1SOTpmtXK3NcjEuCw, RKYlzwmcSyyK3YoV8T5YJw, ru42fueKTYWDuaUhgGkXuQ], have discovered [{es01}{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}{192.168.61.112}{192.168.61.112:9300}{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, {es02}{mRFp_9x1T4ea_2KHEUzdyQ}{fT8zs_b-SrSRi4Zvum4q0Q}{192.168.61.113}{192.168.61.113:9300}{cdhilmrstw}{ml.machine_memory=2933932032, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}{192.168.61.114}{192.168.61.114:9300}{cdhilmrstw}{ml.machine_memory=2933927936, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}] which is not a quorum; discovery will continue using [192.168.61.113:9300, 192.168.61.114:9300] from hosts providers and [{es01}{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}{192.168.61.112}{192.168.61.112:9300}{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] from last-known cluster state; node term 2, last-accepted version 58 in term 2" }

Can you share the same message from the other two nodes as well?

192.168.61.112 log

es01 | {"type": "server", "timestamp": "2021-01-26T09:49:15,220Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "es-cluster", "node.name": "es01", "message": "master not discovered or elected yet, an election requires at least 2 nodes with ids from [bYUUn1SOTpmtXK3NcjEuCw, RKYlzwmcSyyK3YoV8T5YJw, ru42fueKTYWDuaUhgGkXuQ], have discovered [{es01}{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}{192.168.61.112}{192.168.61.112:9300}{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, {es02}{mRFp_9x1T4ea_2KHEUzdyQ}{fT8zs_b-SrSRi4Zvum4q0Q}{192.168.61.113}{192.168.61.113:9300}{cdhilmrstw}{ml.machine_memory=2933932032, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}{192.168.61.114}{192.168.61.114:9300}{cdhilmrstw}{ml.machine_memory=2933927936, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}] which is not a quorum; discovery will continue using [192.168.61.113:9300, 192.168.61.114:9300] from hosts providers and [{es01}{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}{192.168.61.112}{192.168.61.112:9300}{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] from last-known cluster state; node term 2, last-accepted version 58 in term 2" }

192.168.61.113 log

es02 | {"type": "server", "timestamp": "2021-01-26T09:50:08,093Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "es-cluster", "node.name": "es02", "message": "master not discovered or elected yet, an election requires 2 nodes with ids [ru42fueKTYWDuaUhgGkXuQ, mRFp_9x1T4ea_2KHEUzdyQ], have discovered [{es02}{mRFp_9x1T4ea_2KHEUzdyQ}{fT8zs_b-SrSRi4Zvum4q0Q}{192.168.61.113}{192.168.61.113:9300}{cdhilmrstw}{ml.machine_memory=2933932032, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, {es01}{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}{192.168.61.112}{192.168.61.112:9300}{cdhilmrstw}{ml.machine_memory=2933927936, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}{192.168.61.114}{192.168.61.114:9300}{cdhilmrstw}{ml.machine_memory=2933927936, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}] which is a quorum; discovery will continue using [192.168.61.112:9300, 192.168.61.114:9300] from hosts providers and [{es02}{mRFp_9x1T4ea_2KHEUzdyQ}{fT8zs_b-SrSRi4Zvum4q0Q}{192.168.61.113}{192.168.61.113:9300}{cdhilmrstw}{ml.machine_memory=2933932032, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }

192.168.61.114 log

es03 | {"type": "server", "timestamp": "2021-01-26T09:50:16,411Z", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "es-cluster", "node.name": "es03", "message": "master not discovered or elected yet, an election requires 2 nodes with ids [QhLl9zbgQt6mQku_yLTqNw, ru42fueKTYWDuaUhgGkXuQ], have discovered [{es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}{192.168.61.114}{192.168.61.114:9300}{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}, {es01}{ru42fueKTYWDuaUhgGkXuQ}{0ASYKum3Sd6P2uWrQbk8uw}{192.168.61.112}{192.168.61.112:9300}{cdhilmrstw}{ml.machine_memory=2933927936, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {es02}{mRFp_9x1T4ea_2KHEUzdyQ}{fT8zs_b-SrSRi4Zvum4q0Q}{192.168.61.113}{192.168.61.113:9300}{cdhilmrstw}{ml.machine_memory=2933932032, ml.max_open_jobs=20, xpack.installed=true, transform.node=true}] which is a quorum; discovery will continue using [192.168.61.112:9300, 192.168.61.113:9300] from hosts providers and [{es03}{QhLl9zbgQt6mQku_yLTqNw}{4U29XGKSQHuayMfLpjH8xw}{192.168.61.114}{192.168.61.114:9300}{cdhilmrstw}{ml.machine_memory=2933927936, xpack.installed=true, transform.node=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }

the final question , i know https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-compose-file OK , but how can i replace it with three different host(IP)

an election requires at least 2 nodes with ids from [bYUUn1SOTpmtXK3NcjEuCw, RKYlzwmcSyyK3YoV8T5YJw, ru42fueKTYWDuaUhgGkXuQ]
an election requires 2 nodes with ids [ru42fueKTYWDuaUhgGkXuQ, mRFp_9x1T4ea_2KHEUzdyQ]
an election requires 2 nodes with ids [QhLl9zbgQt6mQku_yLTqNw, ru42fueKTYWDuaUhgGkXuQ]

I see at least 5 node IDs here, which means either you have 5 nodes or else you have wiped the data paths of some nodes causing them to generate new IDs. If you did lose the contents of the data path then this cluster is broken, the simplest fix is to wipe everything and start from the beginning again.

1 Like

Thank you for your help. The problem has been solved. I use this command:

docker system prune --all --force --volumes

Welcome to China! :crazy_face:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.