As a precursor, see the mlockall section in http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/setup-configuration.html#setup-configuration-memory
The location of some of the files below may vary depending on your distribution.
Systemd
- In
elasticsearch.yml: setbootstrap.mlockall: true - In
/etc/sysconfig/elasticsearchset:MAX_LOCKED_MEMORY=unlimited.ES_HEAP_SIZEmust also be set - In
/usr/lib/systemd/system/elasticsearch.serviceset:LimitMEMLOCK=infinity - Run
systemctl daemon-reload - Restart Elasticsearch
SysV
- In
elasticsearch.ymlset:bootstrap.mlockall: true - In
/etc/sysconfig/elasticsearchset:MAX_LOCKED_MEMORY=unlimited - Restart Elasticsearch
Upstart
- In
elasticsearch.ymlset:bootstrap.mlockall: true - In
/etc/default/elasticsearchset:MAX_LOCKED_MEMORY=unlimited.ES_HEAP_SIZEmust also be set - Restart Elasticsearch
You can then test if mlockall is enabled by running curl 'http://127.0.0.1:9200/_nodes/process?pretty' and checking for mlockall: true