CentOS 7 启动ElasticSearch时报错bootstrap checks failed
错误:
[2021-01-27T11:50:22,939][INFO ][o.e.b.BootstrapChecks ] [cnetos7.hanhua.com] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
[4]: max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
ERROR: Elasticsearch did not exit normally - check the logs at /usr/local/elasticsearch7/logs/elasticsearch.log
第一个问题:
max file descriptors [1024] for elasticsearch process is too low, increase to at least [4029]
解决方案:
limits.conf,追加以下内容
vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
注:如果编辑重启启动之后还不能消除这个错误,则重登陆用户。
第二个问题:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决方案:
sysctl.conf,追加以下内容:
[root@cnetos7 elasticsearch7]# vim /etc/sysctl.conf
vm.max_map_count=262144
保存后,执行:
[root@cnetos7 elasticsearch7]# sysctl -p
重新启动,成功。
第三个问题:
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
出现错误的原因:是因为centos6.x操作系统不支持SecComp,而elasticsearch 5.5.2默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决方案:
在elasticsearch.yml中添加配置项:
[root@cnetos7 config]# vim elasticsearch.yml
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
第四个问题:
max number of threads [1024] for user [wh] likely too low, increase to at least [2048]
解决方案:
修改如下内容:
[root@cnetos7 config]# vim /etc/security/limits.d/90-nproc.conf
soft nproc 1024
#修改为
soft nproc 2048
注:以上问题如果编辑重启启动之后还不能消除这个错误,则重登陆用户。