Max virtual memory areas .max_map_count [65530] is too low

#1

Hi,

I am new to Opendistro for Elasticsearch and tried to do the first steps as described in https://aws.amazon.com/de/blogs/opensource/running-open-distro-for-elasticsearch/

When I used the default docker-compose file there were several errors. So I decided to remove the 2nd Elasticsearch and the Kibana node. This is my docker-compse file.

version: ‘3’
services:
odfe-node1:
image: amazon/opendistro-for-elasticsearch:0.7.0
container_name: odfe-node1
environment:
- cluster.name=odfe-cluster
- bootstrap.memory_lock=true # along with the memlock settings below, disables swapping
- “ES_JAVA_OPTS=-Xms512m -Xmx512m” # minimum and maximum Java heap size, recommend setting both to 50% of system RAM
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- odfe-data1:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9600:9600 # required for Performance Analyzer
networks:
- odfe-net
volumes:
odfe-data1:

networks:
odfe-net:

When I start the container with ‘sudo docker-compose up’ (I need to use sudo because the docker-daemon is started as user root) Elasticsearch does not start beacuse of the following error:

odfe-node1 | [2019-03-27T08:56:53,596][INFO ][o.e.b.BootstrapChecks ] [TASvLBx] bound or publishing to a non-loopback address, enforcing bootstrap checks
odfe-node1 | ERROR: [1] bootstrap checks failed
odfe-node1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

How can I increase the virtual memory for Elasticseach in the docker container?

Thanx for help in advance!

Martin

#2

You don’t need to increase the virtual memory for Elasticsearch at container level, you can do it for the host machine by running this command:

sudo sysctl -w vm.max_map_count=262144

and then restart your docker-containers.

#3

The command

solved the problem.

Thank you!