Reputation: 14175
I am trying to setup elasticsearch on a single host. Here is how my configuration looks like:
elasticsearch.yml
node.name: ${HOSTNAME}
network.host: _site_, _local_
http.port: 9200
transport.tcp.port: 9300
cluster.name: "test_cluster"
node.local: true
kibana.yml
server.host: 0.0.0.0
elasticsearch.url: http://localhost:9200
On following command:
curl -XGET 'localhost:9200/_cluster/health?pretty'
I get following message:
{
"error" : {
"root_cause" : [
{
"type" : "master_not_discovered_exception",
"reason" : null
}
],
"type" : "master_not_discovered_exception",
"reason" : null
},
"status" : 503
}
In log file I see following message:
not enough master nodes discovered during pinging (found [[]], but needed [-1]), pinging again
Could someone please point me right direction here?
Upvotes: 12
Views: 16382
Reputation: 1555
Following changes in eleasticsearch.yml
worked for me
Node
node.name: node-1
Paths
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
Network
network.host: 0.0.0.0
http.port: 9200
Discovery
discovery.seed_hosts: "127.0.0.1:9300"
cluster.initial_master_nodes: ["node-1"]
Steps:
sudo systemctl stop elasticsearch.service
sudo nano /etc/elasticsearch/elasticsearch.yml
Apply above changes, save and close the editor.
sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
NOTE: elasticsearch7 is used with ubuntu 20.04, it should work with other versions as well
Upvotes: 4
Reputation: 7988
On my side, after installing ES 7+, I had to set node-1 as a master-eligible node in the new cluster.
sudo nano /etc/elasticsearch/elasticsearch.yml
cluster.initial_master_nodes: ["node-1"]
Upvotes: 1
Reputation: 1678
I spent days (sigh) on basically this. I was trying to upgrade my single node cluster from 6.x es to 7.x, and I kept dying on the hill of "master_not_discovered_exception".
What finally solved it for me was examining a completely fresh install of 7.x.
For my single-node cluster, my /etc/elasticsearch/elasticsearch.yml needed the line:
discovery.type: single-node
I hope that saves someone else from spending days like I did. In my defence, I'm very new to es.
Upvotes: 34
Reputation: 1931
According to this link, for the very first time you should set initial_master_nodes
config like this in /etc/elasticsearch/elasticsearch.yml
:
node.name: "salehnode"
cluster.initial_master_nodes:
- salehnode
Upvotes: 1
Reputation: 1
You can try this in your elasticsearch.yml
:
discovery.zen.minimum_master_nodes: 1
I think ES
will always find discovery.zen.ping.unicast.hosts
until it
finds nodes
of count
equal to minimum_master_nodes
.
Upvotes: 0
Reputation: 9
First I dont think you need network.host
setting for this.
In your log it is trying to get a master, but result is 0
Can you try setting properties like:
node.master: true
node.data:true
Also can you please put more logs here, if it doesnt work
Upvotes: 0