Elasticsearch进程内存锁定失败 [英] Elasticsearch process memory locking failed
问题描述
我已经设置了boostrap.memory_lock = true 更新了/etc/security/limits.conf,为弹性搜索用户添加了无限的内存锁
I have set boostrap.memory_lock=true Updated /etc/security/limits.conf added memlock unlimited for elastic search user
我的弹性搜索运行了好几个月.突然失败了一天前.在日志中,我可以看到以下错误,并且过程永远不会开始
My elastic search was running fine for many months. Suddenly it failed 1 day back. In logs I can see below error and process never starts
错误:引导检查失败 要求弹性搜索过程进行内存锁定,但内存未锁定
ERROR: bootstrap checks failed memory locking requested for elasticsearch process but memory is not locked
我按ulimit -as,我可以看到最大锁定内存设置为无限制.这是怎么了?我已经尝试了几个小时,但徒劳无功.请帮忙.
I hit ulimit -as and I can see max locked memory set to unlimited. What is going wrong here? I have been trying for hours but all in vain. Please help.
OS是RHEL 7.2 Elasticsearch 5.1.2
OS is RHEL 7.2 Elasticsearch 5.1.2
ulimit-作为输出
ulimit -as output
core file size (blocks -c) 0
data seg size (kbytes -d) unlimited
scheduling policy (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 83552
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -q) 8
POSIX message queues (bytes,-q) 819200
real-time priority (-r) 0
stack size kbytes, -s) 8192
cpu time seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
推荐答案
这是我在RedHat/Centos 7上的ES节点上锁定内存的操作(如果其他发行版使用 systemd,它将在其他发行版上工作).
Here is what I have done to lock the memory on my ES nodes on RedHat/Centos 7 (it will work on other distributions if they use systemd).
您必须在4个不同的地方进行更改:
You must make the change in 4 different places:
1)/etc/sysconfig/elasticsearch
在sysconfig:/etc/sysconfig/elasticsearch
上,您应该具有:
On sysconfig: /etc/sysconfig/elasticsearch
you should have:
ES_JAVA_OPTS="-Xms4g -Xmx4g"
MAX_LOCKED_MEMORY=unlimited
(用建议的这里)
2)/etc/security/limits.conf
关于安全限制配置:/etc/security/limits.conf
您应该具有
On security limits config: /etc/security/limits.conf
you should have
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
3)/usr/lib/systemd/system/elasticsearch.service
在服务脚本:/usr/lib/systemd/system/elasticsearch.service
上,您应该取消注释:
On the service script: /usr/lib/systemd/system/elasticsearch.service
you should uncomment:
LimitMEMLOCK=infinity
您应该在更改服务脚本后执行systemctl daemon-reload
you should do systemctl daemon-reload
after changing the service script
4)/etc/elasticsearch/elasticsearch.yml
最后在elasticsearch配置上:/etc/elasticsearch/elasticsearch.yml
,您应该添加:
On elasticsearch config finally: /etc/elasticsearch/elasticsearch.yml
you should add:
bootstrap.memory_lock: true
就这样,重新启动节点,RAM将被锁定,您应该注意到性能有了重大改善.
Thats it, restart your node and the RAM will be locked, you should notice a major performance improvement.
这篇关于Elasticsearch进程内存锁定失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!