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

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
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?

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