Docker Compose elastic Cluster setup

Hi!

Please find that we are able to set up a single elastic search server and kibana suing docker-compose. But when we try to set up a cluster using the following we face issues while starting elastic search.

The elasticsearch1 server exit with exit code 137 which is soon followed by elasticsearch2 and then kibana. Please see docker-compose.yml below.

Any ideas / suggestion?

Regards,
Abhishek

Docker-compose.yml

version: '2'
services:
elasticsearch1:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
container_name: elasticsearch1
environment:
- cluster.name=docker-cluster
- xpack.security.enabled=false
- http.cors.enabled=true
- http.cors.allow-origin=http://local.test.xxxxx.com:4200
- http.cors.allow-headers=Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With
- http.cors.allow-credentials=true
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
mem_limit: 1g
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet
elasticsearch2:
image: docker.elastic.co/elasticsearch/elasticsearch:5.4.0
environment:
- cluster.name=docker-cluster
- xpack.security.enabled=false
- http.cors.enabled=true
- http.cors.allow-origin=http://local.test.xxxxx.com:4200
- http.cors.allow-headers=Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With
- http.cors.allow-credentials=true
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=elasticsearch1"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
mem_limit: 1g
cap_add:
- IPC_LOCK
volumes:
- esdata2:/usr/share/elasticsearch/data
ports:
- 9201:9200
links:
- "elasticsearch1:elastic-url"
networks:
- esnet
kibana:
image: docker.elastic.co/kibana/kibana:5.4.0
container_name: kibana
environment:
- http.host=0.0.0.0
- transport.host=127.0.0.1
- "ELASTICSEARCH_USERNAME=elastic"
- "ELASTICSEARCH_PASSWORD=changeme"
- "ELASTICSEARCH_URL=http://elasticsearch1:9200"
ports:
- 5601:5601
links:
- "elasticsearch1:elastic-url"
networks:
- esnet

volumes:
esdata1:
driver: local
esdata2:
driver: local
networks:
esnet:

This looks wrong:

9201:9200

Should be

9201:9201

We also have docker-compose files for the stack here - https://github.com/elastic/stack-docker

in my opinion elasticsearch will always start on port 9200 in the container but we can expose them on different port - 9201 to the outside for the second server in the cluster.

Thank you for sharing the link but this file doesn't have the elasticsearch server on a cluster. We have no problem running the single instance but face issue when starting the 2 server in the cluster.

Ha sorry. You're right. I misread the config file. I thought it was an elasticsearch setting http.port: 9201-9200 which is not the case.

No need to apologies! we all are in this together trying to explore this wonderful technology

Hi. I'm also trying to get a elastic/kibana/logstash node setup using Docker compose.

I'm using this configuration, based off the official one.

When I run this command, I get the following error from configure_kibana:

sudo ELASTIC_VERSION=5.4.0 TAG=5.4.0 docker-compose up
ubuntu_elasticsearch_1 is up-to-date
ubuntu_kibana_1 is up-to-date
Starting ubuntu_logstash_1
Starting ubuntu_configure_kibana_1
Attaching to ubuntu_elasticsearch_1, ubuntu_kibana_1, ubuntu_logstash_1, ubuntu_configure_kibana_1
configure_kibana_1 | cat: /usr/local/bin/configure-kibana.sh: Is a directory
...
...
ubuntu_configure_kibana_1 exited with code 0

I have the config/logstash.conf file in my home directory. What could be wrong?

thanks

It'd be better if you created your own thread :slight_smile:

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