Elasticsearch 5.1.1 2nodes cluster, started with docker are not able to see each other

Good evening everyone,

I've two virtual machines rmavmdcos4.mad.roche.com and rmavmdcos5.mad.roche.com ( and 191)

With docker 1.12 installed on them

I'm trying to set an elasticsearch 5.1.1 cluster running docker images on each node.

I've followed instructions detailed at

In order to generate the custom image, but we're not able to use docker compose as detailed in the web page

[root@rmavmdcos4 config]# cat Dockerfile
FROM docker.elastic.co/elasticsearch/elasticsearch:5.1.1
ADD elasticsearch.yml /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch /usr/share/elasticsearch/config/elasticsearch.yml
ADD log4j2.properties /usr/share/elasticsearch/config/
USER root
RUN chown elasticsearch:elasticsearch /usr/share/elasticsearch/config/log4j2.properties
USER elasticsearch

[root@rmavmdcos4 config]# cat elasticsearch.yml
cluster.name: elasticcluster
bootstrap.memory_lock: true
node.name: {HOSTNAME} network.host: {HOSTNAME}
node.add_lock_id_to_custom_path: false
conf: /usr/share/elasticsearch/config
data: /usr/share/elasticsearch/data
logs: /usr/share/elasticsearch/data
shared_data: /usr/share/elasticsearch/data
discovery.zen.minimum_master_nodes: 1
node.max_local_storage_nodes: 10

[root@rmavmdcos4 config]# cat log4j2.properties
status = error
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n
rootLogger.level = info
rootLogger.appenderRef.console.ref = console

[root@rmavmdcos4 config]# docker build --tag=elasticsearch-custom .

When I ran;

[root@rmavmdcos4 config]# docker -D -H unix:///var/run/docker.sock run --cap-add=IPC_LOCK --ulimit memlock=-1:-1 --ulimit nofile=65536:65536 --cpu-shares 1024 --memory 2634022912 -e ES_JAVA_OPTS="-Xms2G -Xmx2G" -v /system/mesosf/elasticsearch/data:/usr/share/elasticsearch/data/:rw --net bridge -p 9200:9200/tcp -p 9300:9300/tcp elasticsearch-custom

The cluster starts and its accessible

But when I ran same command on second node(rmavmdcos5), it fails reporting

DEBU[0023] framesize: 2624
[2016-12-14T15:22:07,257][WARN ][o.e.d.z.ZenDiscovery ] [8c46fe4012bc] failed to connect to master [{c34da5043b02}{5kbMnV01SwKM59PPBX-ouw}{4mkX7JcS-clhnQOERUJg}{c34da5043b02}{}], retrying...
org.elasticsearch.transport.ConnectTransportException: [c34da5043b02][] connect_timeout[30s]
at org.elasticsearch.transport.netty4.Netty4Transport.connectToChannels(Netty4Transport.java:379) ~[?:?]

Problem seems to be that the elastic nodes are running on IP's like 172.17.0.x, and the information detailed on unicast.host are the real IP of the virtual hosts

Anyone knows how to set the unicast host or adapt the elasticsearch.yaml file in order to make both nodes see each other?

Any idea will be welcome

Thanks in advance for your time and help


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