Hello,
I am trying to create a 3 node elasticsearch 5.0 cluster on digital ocean. I am using systemd to run elasticsearch and each elasticsearch instance runs inside a docker container ( the official elasticsearch container ). This is the elasticsearch config file
And this is the ExecStart
portion of the unit file
ExecStart=/bin/sh -c '/usr/bin/docker run -v /home/core/esdata:/usr/share/elasticsearch/data --rm --name elasticsearch-${instance_index} \
-e ES_HOSTS="elasticsearch-3,elasticsearch-2,elasticsearch-1," \
-e MIN_MASTER_NODES="2" \
-e NUM_REPLICAS="1" \
-p 9200:9200 -p 9300:9300 elasticsearch:5 \
/bin/sh -c \'chown -R elasticsearch:elasticsearch /usr/share/elasticsearch/data ; \
gosu elasticsearch elasticsearch \''
After all the 3 nodes start, none of them are able to connect and a master not discovered error shows on health check. This is the error trace.
The ES_HOSTS
variable is set in the env as elasticsearch-3,elasticsearch-2,elasticsearch-1,
.
This is the complete env inside the elasticsearch containers.
HOSTNAME=elasticsearch-1
ES_HOSTS=elasticsearch-3,elasticsearch-2,elasticsearch-1,
NUM_REPLICAS=1
CA_CERTIFICATES_JAVA_VERSION=20140324
PATH=/usr/share/elasticsearch/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
WEAVE_CIDR=192.168.16.1/24
PWD=/usr/share/elasticsearch
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre
LANG=C.UTF-8
JAVA_VERSION=8u111
SHLVL=1
HOME=/root
JAVA_DEBIAN_VERSION=8u111-b14-2~bpo8+1
MIN_MASTER_NODES=2
ELASTICSEARCH_VERSION=5.0.0
GOSU_VERSION=1.7
_=/usr/bin/env
and from inside the container I can reach the other elasticsearch instances i.e. from elasticsearch-1 i can reach elasticsearch-2
curl http://elasticsearch-2:9200
{
"name" : "xGIB2_i",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "_na_",
"version" : {
"number" : "5.0.0",
"build_hash" : "253032b",
"build_date" : "2016-10-26T05:11:34.737Z",
"build_snapshot" : false,
"lucene_version" : "6.2.0"
},
"tagline" : "You Know, for Search"
}
System specification
OS - CoreOS
version - stable (1185.3)