# Elasticsearch cluster in two different hosts with one node as Docker container and another as Service

**URL:** <https://discuss.elastic.co/t/elasticsearch-cluster-in-two-different-hosts-with-one-node-as-docker-container-and-another-as-service/195197>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [August 14, 2019, 12:13pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-in-two-different-hosts-with-one-node-as-docker-container-and-another-as-service/195197 "2019-08-14T12:13:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Namrata\_Khobragade](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/namrata_khobragade/32/51733_2.png) [@Namrata\_Khobragade](https://discuss.elastic.co/u/Namrata_Khobragade)\
**Post date:** [August 14, 2019, 12:13pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-in-two-different-hosts-with-one-node-as-docker-container-and-another-as-service/195197/1 "2019-08-14T12:13:34Z")

</div>

I have an existing Elasticsearch server in Ubuntu, for the purpose of better performance I want to add one more node in the Cluster. Can I do it with docker by not changing the existing system?  
I have tried it with docker-compose file as follows:

##########################  
version: '2.2'  
services:  
elasticsearch:  
image: [docker.elastic.co/elasticsearch/elasticsearch:7.2.0](http://docker.elastic.co/elasticsearch/elasticsearch:7.2.0)  
container\_name: elasticsearch  
environment:  
- "cluster.name=elasticsearch"  
- "node.name=slave-node1"  
- "node.master=false"  
- "node.data=true"  
- "network.host=192.168.2.20"  
- "Des.network.publish\_host=192.168.2.20"  
- "network.bind\_host=192.168.2.20"  
- "bootstrap.memory\_lock=true"  
- "http.cors.enabled=true"  
- "http.cors.allow-origin=\*"  
- "ES\_JAVA\_OPTS=-Xms512m -Xmx512m"  
- "Des.discovery.zen.ping.unicast.hosts=192.168.2.10, 192.168.2.20"  
- "cluster.initial\_master\_nodes=master-node"  
- "Des.discovery.zen.minimum\_master\_nodes:2"  
- "transport.tcp.port:9300"

```
networks:
  - esnet
ports:
  - '9200:9200'
  - '9300:9300'
ulimits:
  memlock:
    soft: -1
    hard: -1
volumes:
  - esdata:/var/lib/elasticsearch

```

volumes:  
esdata:  
driver: local

networks:  
esnet:

##########################

But getting the error:

####################################  
Traceback (most recent call last):  
File "/usr/bin/docker-compose", line 11, in   
load\_entry\_point('docker-compose==1.17.1', 'console\_scripts', 'docker-compose')()  
File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 68, in main  
command()  
File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 121, in perform\_command  
handler(command, command\_options)  
File "/usr/lib/python2.7/dist-packages/compose/cli/main.py", line 952, in up  
start=not no\_start  
File "/usr/lib/python2.7/dist-packages/compose/project.py", line 418, in up  
warn\_for\_swarm\_mode(self.client)  
File "/usr/lib/python2.7/dist-packages/compose/project.py", line 648, in warn\_for\_swarm\_mode  
info = client.info()  
File "/usr/lib/python2.7/dist-packages/docker/api/daemon.py", line 90, in info  
return self.\_result(self.\_get(self.\_url("/info")), True)  
File "/usr/lib/python2.7/dist-packages/docker/api/client.py", line 226, in \_result  
self.\_raise\_for\_status(response)  
File "/usr/lib/python2.7/dist-packages/docker/api/client.py", line 222, in \_raise\_for\_status  
raise create\_api\_error\_from\_http\_exception(e)  
File "/usr/lib/python2.7/dist-packages/docker/errors.py", line 19, in create\_api\_error\_from\_http\_exception  
explanation = response.json()['message']  
KeyError: 'message'

##################################

Did anyone try such scenario?

---

<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:** [September 11, 2019, 12:25pm UTC](https://discuss.elastic.co/t/elasticsearch-cluster-in-two-different-hosts-with-one-node-as-docker-container-and-another-as-service/195197/2 "2019-09-11T12:25:19Z")

</div>

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