ConnectionTimeout caused by - ReadTimeoutError, master not discovered yet

Hi folks.

I'm getting this error in a python3 program trying to talk to elasticsearch:

elasticsearch.exceptions.ConnectionTimeout: ConnectionTimeout caused by - ReadTimeoutError(HTTPConnectionPool(host='localhost', port=9200): Read timed out. (read timeout=10))

curl'ing the health status returns:

$ curl 'http://localhost:9200/_cluster/health?pretty=true'
{
"error" : {
"root_cause" : [
{
"type" : "master_not_discovered_exception",
"reason" : null
}
],
"type" : "master_not_discovered_exception",
"reason" : null
},
"status" : 503
}

And that might be related to this repeating error in my elasticsearch.log:

[2019-11-08T11:33:24,176][WARN ][o.e.c.c.ClusterFormationFailureHelper] [centos-7-grok3-installer] master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [127.0.0.1, [::1]] to bootstrap a cluster: have discovered [{centos-7-grok3-installer}{-mDmAKOvT7-q0RNwIUmY5g}{gMxgAO2HRnGhEEDbvC1M9g}{127.0.0.1}{127.0.0.1:9300}{dim}{ml.machine_memory=2959122432, xpack.installed=true, ml.max_open_jobs=20}]; discovery will continue using from hosts providers and [{centos-7-grok3-installer}{-mDmAKOvT7-q0RNwIUmY5g}{gMxgAO2HRnGhEEDbvC1M9g}{127.0.0.1}{127.0.0.1:9300}{dim}{ml.machine_memory=2959122432, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0

I'm also getting:

java.lang.UnsupportedOperationException: sun.misc.Unsafe unavailable

...which appears to be a deprecated API as of Java 11.

I've googled for hours about this, and I found some solutions, but apparently I have a slightly different problem from those.

I'm on CentOS 7.7, and I'm using elasticsearch-7.3.2-x86_64.rpm

I believe I'm using this version of Java:

$ /usr/share/elasticsearch/jdk/bin/java -version
openjdk version "12.0.2" 2019-07-16
OpenJDK Runtime Environment (build 12.0.2+10)
OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

My /etc/elasticsearch/elasticsearch.yml looks like:

$ grep -v '^#' /etc/elasticsearch/elasticsearch.yml
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "[::1]"]

BTW, I'm in a single-host "cluster" for now, but eventually this will become multi-host.

Please help? I'm kinda stuck.

Thanks!

This indicates you have also set

cluster.initial_master_nodes: ["127.0.0.1", "[::1]"]

although I do not understand why this is not shown in the elasticsearch.yml you quoted. This is an incorrect value for this setting since it should contain node name(s) instead. Try:

cluster.initial_master_nodes: "centos-7-grok3-installer"

You can remove this setting after the cluster starts for the first time.

That's working.

I thought I tried that, but perhaps not.

I actually tried a lot of things - too many to list.

Thanks.

1 Like