Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem setting up Elastic Search single-node cluster

I am trying to set up ElasticSearch 7.3.1 in single-node cluster.

I tried adding:

discovery.type: single-node

But then I get the following error:

java.lang.IllegalStateException: cannot start with [discovery.type] set to [single-node] when local node {node-1}{O846-1yHRLiOGzLUx 4RycQ}{KKT2Ljj3QUWiFR4K1ICrDg}{127.0.0.1}{127.0.0.1:9300}{dim}{ml.machine_memory=17179262976, xpack.installed=true, ml.max_open_jobs=20} does not have quorum in voting configura tion VotingConfiguration

If i remove the line discovery.type: single-node then I get the following error:

master not discovered or elected yet, an election requires two nodes with ids [O846-1yHRLiOGzLUx 4RycQ, j1tBqJEtSXO78j6Ym8OceA], have discovered [{node-1}{O846-1yHRLiOGzLUx4RycQ}{KE4tPTGtS7ukT7k-6iLxaw}{127.0.0.1}{127.0.0.1:9300}{dim}{ml.machine_memory=17179262976, xpack.in stalled=true, ml.max_open_jobs=20}] which is not a quorum; discovery will continue using [127.0.0.1:9301, 127.0.0.1:9302, 127.0.0.1:9303, 127.0.0.1:9304, 127.0.0.1:9305, [::1]:9 301, [::1]:9302, [::1]:9303, [::1]:9304, [::1]:9305] from hosts providers and [{node-1}{O846-1yHRLiOGzLUx4RycQ}{KE4tPTGtS7ukT7k-6iLxaw}{127.0.0.1}{127.0.0.1:9300}{dim}{ml.machin e_memory=17179262976, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0

like image 660
Roy Leibovitz Avatar asked Dec 11 '19 09:12

Roy Leibovitz


People also ask

How many nodes should an Elasticsearch cluster have?

To start, we recommend a minimum of three nodes to avoid potential OpenSearch issues, such as split brain (when a lapse in communication leads to a cluster having two master nodes). If you have three dedicated master nodes, we still recommend a minimum of two data nodes for replication.

How do you add a node to an existing Elasticsearch cluster?

To enroll new nodes in your cluster, create an enrollment token with the elasticsearch-create-enrollment-token tool on any existing node in your cluster. You can then start a new node with the --enrollment-token parameter so that it joins an existing cluster.

What happens when a node fails Elasticsearch?

If the node fails, the cluster will stop working. Because there are no replicas in a one-node cluster, you cannot store your data redundantly. However, by default at least one replica is required for a green cluster health status.


1 Answers

an election requires two nodes with ids [O846-1yHRLiOGzLUx 4RycQ, j1tBqJEtSXO78j6Ym8OceA],

This node previously belonged to a 2-node cluster, and you have removed one (i.e. half of them) without following the proper procedure which is required to do this without losing data.

There are two ways forward:

  1. Form the 2-node cluster again and then remove one node properly.

  2. Wipe the data path and start again afresh.

like image 88
Dave Turner Avatar answered Nov 24 '22 15:11

Dave Turner