Elasticsearch 进程内存锁定失败 [英] Elasticsearch process memory locking failed

查看:50
本文介绍了Elasticsearch 进程内存锁定失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了 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

我的弹性搜索运行了好几个月.突然它失败了1天.在日志中,我可以看到以下错误并且进程永远不会启动

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

错误:引导程序检查失败elasticsearch 进程请求内存锁定,但内存未锁定

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.

操作系统是 RHEL 7.2弹性搜索 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

(按照建议将 4g 替换为可用内存的一半 这里)

(replace 4g with HALF your available RAM as recommended here)

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆