How to start an Elasticsearch Cluster by Docker compose?
By Tri Nguyen onIntro
In this post I would like to document how I could start an Elasticsearch Cluster by Docker compose and how I resolve the out of memory error during installation. For detailed instructions and explainations, you can follow this link elastic/get-started.
Steps
- Increase the max_map_count to solve the error
Max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
or
There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (mmap) failed to map 65536 bytes for committing reserved memory.
An error report file with more information is saved as
by executing following commands
sudo vi /etc/sysctl.conf
Add or edit vm.max_map_count
vm.max_map_count=262144
-
Go to elastic/stack-docs, download .env and docker-compose.yml files.
- Edit .env file with the your settings.
- Add this option below to .env for setting Java Heap Size.
ES_JAVA_OPTS=-Xmx256m -Xms256m
- Edit docker-compose.yml with your settings.
- Use the option ES_JAVA_OPTS in section environment of docker-compose.yml file to use Java Heap Size setting in Docker images. This option should be added for all nodes (es01,es02,es03).
environment:
- ES_JAVA_OPTS=${ES_JAVA_OPTS}
- Then now you can start Elasticsearch Cluster with
docker-compose up -d
Comments
If you have any question, you can start a new discussion.