Hello @Luis_Pereira1
Elasticsearch requests to lock the memory (bootstrap.memory_lock=true) but probably didn't manage to do it.
There are 2 possible reasons it didn't manage to lock the memory:
- you do not have enough RAM to lock 2GB of heap for each node on the machine
- the process do not have the rights to lock too much memory
If you open the logs as suggested by the error message,you'll probably find:
Unable to lock JVM Memory: error=12, reason=Cannot allocate memory
This can result in part of the JVM being swapped out.
Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536
These can be adjusted by modifying /etc/security/limits.conf, for example:
# allow user 'elasticsearch' mlockall
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
On docker is even easier. Just add the following lines to your configuration (on each Elasticsearch):
elasticsearch01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.6.2
...
ulimits:
memlock:
soft: -1
hard: -1
This is also detailed in our documentation page.
In general, is even better if you can totally disable swap or set vm.swappines to 1 (as described here), instead of using bootstrap.memory_lock=true.