【已解决】ERROR: bootstrap checks failed memory locking requested for elasticsearch process but memory is not locked
官网说明:
elasticsearch官网建议生产环境需要设置bootstrap.memory_lock: true
官网的解释 是:发生系统swapping的时候ES节点的性能会非常差,也会影响节点的稳定性。所以要不惜一切代价来避免swapping。swapping会导致Java GC的周期延迟从毫秒级恶化到分钟,更严重的是会引起节点响应延迟甚至脱离集群。
所以最好限制住elasticsearch占用的内存情况,可选少用swap
错误内容:
开启bootstrap.memory_lock: true后,在Elasticsearch集群启动的时候,会报如下错误
ERROR: bootstrap checks failed memory locking requested for elasticsearch process but memory is not locked
我使用docker-compose布署的时候,集群一直在重启失败间循环!
解决方法:
方案1:
此方案适用于非systemd管理的linux发行版,centos 6及以下可以仅通过这个方案解决
临时解决方法:
ulimit -l unlimited
永久解决方法:
root权限编辑/etc/security/limits.conf
$ sudo vim /etc/security/limits.conf
添加如下内容,保存退出
* soft memlock unlimited
* hard memlock unlimited
这里的*代表的是所有用户名称,可以更换为指定用户名
另:这里有个坑就是如果/etc/security/limits.d文件夹下的有配置文件,那么会覆盖刚才修改的文件,所以请确保该目录没有其它文件,如有请联系运维人员确认删除
修改/etc/sysctl.conf
sudo echo "vm.swappiness=0" >> /etc/sysctl.conf
这个参数的作用是告诉Linux内核尽少的使用swap分区,不等于禁用swap,通过少使用swap来提高性能。
如果想立即生效而不是重启之后让sysctl.conf生效,请使用sysctl -p
重新登录或重启服务器方可生效
方案2:
适用于systemd管理的发行版,有文章提到centos 7需要使用此方案,本人使用debian 9.9.0 亲测解决问题,推荐先完成上边的方案后尝试本方案
这里还是推荐使用上边方法的第3步,尽少使用swap分区
在Centos7系统中,使用Systemd替代了之前的SysV。/etc/security/limits.conf文件的配置作用域缩小了。/etc/security/limits.conf的配置,只适用于通过PAM认证登录用户的资源限制,它对systemd的service的资源限制不生效。因此登录用户的限制,通过/etc/security/limits.conf与/etc/security/limits.d下的文件设置即可。
对于systemd service的资源设置,则需修改全局配置,全局配置文件放在/etc/systemd/system.conf和/etc/systemd/user.conf,同时也会加载两个对应目录中的所有.conf文件/etc/systemd/system.conf.d/.conf和/etc/systemd/user.conf.d/.conf。system.conf是系统实例使用的,user.conf是用户实例使用的。
全局生效方式:
sudo vim /etc/systemd/system.conf
最下方添加
DefaultLimitNOFILE=65536
DefaultLimitNPROC=32000
DefaultLimitMEMLOCK=infinity
保存, 重启系统
当然由于我是使用的docker,而不是包管理器安装的,给出的是全局的方案
局部生效方式:(针对包管理器安装elasticsearch的形式)
sudo systemctl edit elasticsearch
此命令会在/etc/systemd/system下创建elasticsearch.service.d/override.conf文件
添加如下内容
[Service]
LimitMEMLOCK=infinity
保存,退出,执行如下命令生效
sudo systemctl daemon-reload
如未生效,请尝试重启系统
压缩包版测试
针对使用tar.gz包,指定内存参考如图

我们按图索骥使用命令ES_JAVA_OPTS="-Xms512m -Xmx512m" ./bin/elasticsearch
如果此时出现
[2019-06-20T07:01:36,305][WARN ][o.e.b.JNANatives ] [node-1] Unable to lock JVM Memory: error=12, reason=Cannot allocate memory
[2019-06-20T07:01:36,340][WARN ][o.e.b.JNANatives ] [node-1] This can result in part of the JVM being swapped out.
[2019-06-20T07:01:36,343][WARN ][o.e.b.JNANatives ] [node-1] Increase RLIMIT_MEMLOCK, soft limit: 16777216, hard limit: 16777216
[2019-06-20T07:01:36,343][WARN ][o.e.b.JNANatives ] [node-1] These can be adjusted by modifying /etc/security/limits.conf, for example:
# allow user 'hellxz' mlockall
hellxz soft memlock unlimited
hellxz hard memlock unlimited
请再尝试加上第一种方案,两种方案同时使用
以上就是这些内容,希望能对读者有所帮助
声明,禁止布布扣、码迷、马开东、01海、colabug等网站复制转发此文章,其他请保留文章出处
【已解决】ERROR: bootstrap checks failed memory locking requested for elasticsearch process but memory is not locked的更多相关文章
- ES解决bootstrap checks failed, memory locking requested for elasticsearch process but memory is not locked问题
问题描述: ERROR: [1] bootstrap checks failed[1]: memory locking requested for elasticsearch process but ...
- elasticsearch报错之 memory locking requested for elasticsearch process but memory is not locked
安装elasticsearch报错如下: [2019-01-14T03:57:16,453][ERROR][o.e.b.Bootstrap ] [ip-172-31-30-62.ec2.interna ...
- elasticsearch6.4 memory locking requested for elasticsearch process but memory is not locked
[2018-10-18T05:28:57,713][ERROR][o.e.b.Bootstrap ] [node-45] node validation exception[1] bootstrap ...
- elasticsearch6.4 memory locking requested for elasticsearch process but memory is not locked 终极解决
echo "es hard memlock unlimited">>/etc/security/limits.confecho "es soft memloc ...
- ERROR: bootstrap checks failed
错误描述:Linux默认配置的参数过小,需要自己设置 max file descriptors [4096] for elasticsearch process is too low, increas ...
- 启动Sonar报错,ERROR: [1] bootstrap checks failed [1]: system call filters failed to install
错误提示信息: ERROR: [1] bootstrap checks failed[1]: system call filters failed to install; check the logs ...
- docker 启动 容器----bootstrap checks failed
错误信息: bootstrap checks failed 解决方法: 1.修改elasticsearch.yml配置文件,允许外网访问. vim config/elasticsearch.yml,增 ...
- ElasticSearch启动报错,bootstrap checks failed
修改elasticsearch.yml配置文件,允许外网访问. vim config/elasticsearch.yml# 增加 network.host: 0.0.0.0 启动失败,检查没有通过,报 ...
- idea中解决Error:java: Compilation failed: internal java compiler error的问题
项目中,使用gradle做项目构建,当我们想更改JDK的版本时,报以下错误: Information:Using javac 1.8.0_111 to compile java sourcesInfo ...
随机推荐
- 史上最详细最全的Linux上安装Oracle的教程-centos7
一.安装Oracle前准备 1.创建运行oracle数据库的系统用户和用户组 [humf@localhost ~]$ su root #切换到root Password: [root@localhos ...
- Golang bash脚本自动创建一个go工程
原作者的代码里面,存在智能引号问题,所以他的代码并不能正常运行: 这个是我微调后的版本. 代码如下: #!/bin/bash #————————————– # Module : mk_go_pro.s ...
- iOS 上传APP到AppStore 卡在 Authenticating with the iTunes store 提示
上传APP的时候,遇到了问题,一直卡在Authenticating with the iTunes store提示这里, 解决办法:在Application Loader里面登录需要上传APP的开发者 ...
- bnu oj 13288 Bi-shoe and Phi-shoe
题目链接: http://www.bnuoj.com/contest/problem_show.php?pid=13288 题目大意: 给出一个n,然后给出n个幸运数([1,m]中不能被m整除的数的数 ...
- XOR and Favorite Number Codeforces - 617E || [CQOI2018]异或序列
https://www.luogu.org/problemnew/show/P4462 http://codeforces.com/problemset/problem/617/E 这个是莫队裸题了吧 ...
- 修改SolrCloud在ZooKeeper中的配置文件操作记录
修改SolrCloud在ZooKeeper中的配置文件操作记录. 命令执行目录: /opt/solr-/server/scripts/cloud-scripts/ 1.下载配置文件 ./zkcli., ...
- 转-MySQL for Mac 安装和基本操作
一.安装mysql 1.mysql下载地址:http://dev.mysql.com/downloads/mysql/ 2.安装软件包位于硬盘映象(.dmg)文件中,必须首先双击搜索起中的图标来安装该 ...
- 转】Nodejs对MongoDB模糊查询
原博文出自于: http://blog.fens.me/category/%E6%95%B0%E6%8D%AE%E5%BA%93/page/4/ 感谢! Posted: Jul 1, 2013 Tag ...
- restful api的简单理解
百度百科的描述:一种软件架构风格,设计风格而不是标准,只是提供了一组设计原则和约束条件.它主要用于客户端和服务器交互类的软件.基于这个风格设计的软件可以更简洁,更有层次,更易于实现缓存等机制. RES ...
- 编写高质量Python代码的59个有效方法
Python学习资料或者需要代码.视频加Python学习群:960410445 1. 用Pythonic方式思考 第一条:确认自己使用的Python版本 (1)有两个版本的python处于活跃状态,p ...