# Elasticsearch with multihost docker networking - Cluster connectivity issues

**URL:** <https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671>\
**Category:** Elasticsearch\
**Created:** [May 10, 2016, 2:39pm UTC](https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671 "2016-05-10T14:39:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajay\_bh111](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@ajay\_bh111](https://discuss.elastic.co/u/ajay_bh111)\
**Post date:** [May 10, 2016, 2:39pm UTC](https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671/1 "2016-05-10T14:39:14Z")

</div>

When using external networking using calico, cluster nodes though can talk to each other on ports 9200 & 9300 but additional port needed for cluster discovery being dynamic hence are not opened by default. Therefore discovery process is unable to find other nodes of the cluster which are running in docker container but on different host.

Is it possible for Elasticsearch to use only specified ports only for inter node cluster communication ?

Example: using calico for external networking of containers:  
common.network ] configuration:  
cali0  
inet 192.168.0.7 netmask:255.255.255.0 broadcast:0.0.0.0 scope:site  
UP MULTICAST mtu:1500 index:89

eth1  
inet 172.18.0.3 netmask:255.255.0.0 broadcast:0.0.0.0 scope:site  
UP MULTICAST mtu:1500 index:91

**Logs in cluster start give Null pointer exception:**  
[2016-05-10 13:55:20,567][DEBUG][common.netty] using gathering [true]  
[2016-05-10 13:55:20,643][DEBUG][discovery.zen.elect] [es01] using minimum\_master\_nodes [-1]  
[2016-05-10 13:55:20,645][DEBUG][discovery.zen.ping.unicast] [es01] using initial hosts [**es01:9300, es02:9300, es03:9300], with concurrent\_connects [10]**  
[2016-05-10 13:55:20,667][DEBUG][discovery.zen] [es01] using ping.timeout [3s], join.timeout [1m], master\_election.filter\_client [true], master\_election.filter\_data [false]  
[2016-05-10 13:55:20,671][DEBUG][discovery.zen.fd] [es01] [master] uses ping\_interval [1s], ping\_timeout [30s], ping\_retries [3]  
....

[2016-05-10 13:55:22,436][WARN][transport.netty] [es01] **exception caught on transport layer [[id: 0xeb5ace79, /192.168.0.7:49759 =\> es02/192.168.0.4:9300]], closing connection**  
**java.lang.NullPointerException**  
\*\* at\*\*

**When using the HOST network for containers: All nodes are discovered:**

[2016-05-10 14:03:21,776][DEBUG][common.network] configuration:

eth0  
inet 10.236.133.168 netmask:255.255.252.0 broadcast:10.236.135.255 scope:site  
UP MULTICAST mtu:1500 index:2

docker\_gwbridge  
inet 172.18.0.1 netmask:255.255.0.0 broadcast:0.0.0.0 scope:site  
MULTICAST mtu:1500 index:3

docker0  
inet 172.17.0.1 netmask:255.255.0.0 broadcast:0.0.0.0 scope:site  
MULTICAST mtu:1500 index:4

**Cluster start Log:**  
[2016-05-10 14:03:21,780][DEBUG][common.netty] using gathering [true]  
[2016-05-10 14:03:21,819][DEBUG][discovery.zen.elect] [mesos-s1] using minimum\_master\_nodes [-1]  
[2016-05-10 14:03:21,821][DEBUG][discovery.zen.ping.unicast] [mesos-s1] using initial hosts [mesos-s1:9300, mesos-s2:9300, mesos-s3:9300], with concurrent\_connects [10]  
[2016-05-10 14:03:21,830][DEBUG][discovery.zen] [mesos-s1] using ping.timeout [3s], join.timeout [1m], master\_election.filter\_client [true], master\_election.filter\_data [false]  
[2016-05-10 14:03:21,832][DEBUG][discovery.zen.fd] [mesos-s1] [master] uses ping\_interval [1s], ping\_timeout [30s], ping\_retries [3]  
[[2016-05-10 14:03:22,130][DEBUG][script] [mesos-s1] using script cache with max\_size [100], expire [null]  
[2016-05-10 14:03:22,138][DEBUG][cluster.routing.allocation.decider] [mesos-s1] using node\_concurrent\_recoveries [4], node\_initial\_primaries\_recoveries [10]  
[2016-05-10 14:03:22,139][DEBUG][cluster.routing.allocation.decider] [mesos-s1] using [cluster.routing.allocation.allow\_rebalance] with [indices\_all\_active]  
....  
[2016-05-10 14:03:25,805][DEBUG][discovery.zen] [mesos-s1] filtered ping responses: (filter\_client[true], filter\_data[false])  
--\> ping\_response{node [{mesos-s3}{Ub03F05zSES5oiXBUlL3BA}{10.236.133.170}{10.236.133.170:9300}{master=true}], id[12], master [null], hasJoinedOnce [false], cluster\_name[es\_dtest]}  
--\> ping\_response{node [{mesos-s2}{OIVsOQ\_RQfi0LgsExnY46Q}{10.236.133.169}{10.236.133.169:9300}{master=true}], id[17], master [{mesos-s2}{OIVsOQ\_RQfi0LgsExnY46Q}{10.236.133.169}{10.236.133.169:9300}{master=true}], hasJoinedOnce [true], cluster\_name[es\_dtest]}

Reason for this is ports other than 9200 and 9300 are needed between cluster nodes and containers only expose ports 9200 and 9300 . This blocks the communication. See ports connection sample in working state:  
tcp 0 0 10.236.133.168:9300 10.236.133.170:39200 ESTABLISHED 14736/java  
tcp 0 0 10.236.133.168:41268 10.236.133.169:9300 ESTABLISHED 14736/java  
tcp 0 0 10.236.133.168:41275 10.236.133.169:9300 ESTABLISHED 14736/java  
tcp 0 0 10.236.133.168:36775 10.236.133.87:2379 ESTABLISHED 11283/confd

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 11, 2016, 11:28pm UTC](https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671/2 "2016-05-11T23:28:31Z")

</div>

> [@ajay\_bh111](#):
>
> Is it possible for Elasticsearch to use only specified ports only for inter node cluster communication ?

By default ES will use 9300-9399 for node comms. It should usually only use 9300, but may pick another one in the range if that is taken.

---

<div class="post-metadata">

**Author:** ![ajay\_bh111](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@ajay\_bh111](https://discuss.elastic.co/u/ajay_bh111)\
**Post date:** [May 13, 2016, 5:53pm UTC](https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671/3 "2016-05-13T17:53:19Z")

</div>

My concern is how can I force ES the ports in bold to be 9300 instead of random ports. See below:

tcp 0 0 10.236.133.168: **41268** 10.236.133.169:9300 ESTABLISHED 14736/java  
tcp 0 0 10.236.133.168: **41275** 10.236.133.169:9300 ESTABLISHED 14736/java

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 15, 2016, 6:41am UTC](https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671/4 "2016-05-15T06:41:32Z")

</div>

Those are the originating ports and will always be random. You can see the second IP:PORT combo has 9300, that is the destination for that connection and shows that ES is listening on 9300.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:51pm UTC](https://discuss.elastic.co/t/elasticsearch-with-multihost-docker-networking-cluster-connectivity-issues/49671/5 "2017-07-05T22:51:23Z")

</div>


