Why is mlockall setting failing on Elasticsearch?

QUESTION

According to the elasticsearch.yml:

bootstrap.mlockall: true

But according to ES when queried they are all false.

curl 'http://127.0.0.1:9200/_nodes/process?pretty; | grep mlockall 
 "mlockall" : false 
 "mlockall" : false 
 "mlockall" : false 
 "mlockall" : false 
 "mlockall" : false 

Which is correct? Maybe a bug?

ANSWER

If you see that mlockall is false, then it means that the the mlockall request has failed. The most probable reason is that the user running Elasticsearch doesn’t have permission to lock memory. This can be granted by running

ulimit -l unlimited

as root before starting Elasticsearch.

Another possible reason why mlockall can fail is that the temporary directory (usually /tmp) is mounted with the noexec option. This can be solved by specfying a new temp directory, by starting Elasticsearch with:

./bin/elasticsearch -Djna.tmpdir=/path/to/new/dir
1 Like