Prevent elasticsearch from being killed by OOM killer -
i'm new elasticsearch , i'm guessing way configured server sub-optimal since i'm running problem oom killer killing elasticsearch/java process after short while.this avoided having server configured correctly. please point out in configuration needs changed smooth operation of es?
on both of these servers (which clustered), come es/java process having been killed.
here current setup:
===========================================
server 1 (frontend server) server has 8gb of ram , running gunicorn, flask, , django
elasticsearch.yml:
node.master: true node.data: true bootstrap.mlockall: true
/etc/default/elasticsearch
es_heap_size=5g max_open_files=65535 max_locked_memory=unlimited
===========================================
server 2 (dedicated elasticsearch server) 8gb ram , no other applications running
elasticsearch.yml:
node.master: false node.data: true bootstrap.mlockall: true
/etc/default/elasticsearch
es_heap_size=5g max_open_files=65535 max_locked_memory=unlimited
===========================================
in elasticsearch.yml file, see line says "you should make sure elasticsearch process allowed lock memory, eg. using ulimit -l unlimited
" haven't done enable that. need take action here?
if try typing in, get...
myuser@es1:~$ sudo ulimit -l unlimited sudo: ulimit: command not found
here have done lock memory on es nodes, version 5.4.0 on redhat/centos 7 (it work on other distributions if use systemd).
you must make change in 4 different places:
1) /etc/sysconfig/elasticsearch
on sysconfig: /etc/sysconfig/elasticsearch
should have:
es_java_opts="-xms4g -xmx4g" max_locked_memory=unlimited
(replace 4g half available ram recommended here)
2) /etc/security/limits.conf
on security limits config: /etc/security/limits.conf
should have
elasticsearch soft memlock unlimited elasticsearch hard memlock unlimited
3) /usr/lib/systemd/system/elasticsearch.service
on service script: /usr/lib/systemd/system/elasticsearch.service
should uncomment:
limitmemlock=infinity
you should systemctl daemon-reload after changing service script
4) /etc/elasticsearch/elasticsearch.yml
on elasticsearch config finally: /etc/elasticsearch/elasticsearch.yml
should add:
bootstrap.memory_lock: true
thats it, restart node , ram locked, should notice major performance improvement.
Comments
Post a Comment