发现问题背景,有天突然想用ip(非127.0.0.1),形如192.168.1.16去访问elasticsearch,当我用 crul 192.168.1.16:9201的时候,竟然连不了,后来去官网那看了下文档,说要修改这个参数:network.host
我把这个参数修改成这个值后:network.host: 0.0.0.0,再去启动elasticsearch就报下边这个错误:
[2018-11-14T22:43:15,577][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [es6] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
bootstrap checks failed 翻译过来就是bootstrap检查失败,就是上边那四个项目失败
1:第一个失败:[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
翻译过来就是:elasticsearch用户拥有的可创建文件描述的权限太低,目前是4096,至少需要65536
解决方法:
切换到root用户修改
vim /etc/security/limits.conf 在最下边加上:
es6 hard nofile 65536
es6 soft nofile 65536
上边的es6是ES的用户
2:第二个失败:[2]: max number of threads [1024] for user [es6] is too low, increase to at least [4096]
翻译过来的意思就是:目前es6这个用户能启动的线程数1024太低了,最少需要4096
解决方法:
vim /etc/security/limits.d/90-nproc.conf ,修改配置如下:
* soft nproc 1024
修改为:
* soft nproc 2048
3:第三个失败:[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
翻译过来的意思是:目前最大虚拟内存65530太小了,最少需要262144
解决方法:切换root账户 vim /etc/sysctl.conf
增加一行 vm.max_map_count=262144
接着执行 sysctl -p使其生效:
4:第四个失败:[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
这是在因为Centos6不支持SecComp,而ES5.2.0以后默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
#bootstrap.memory_lock: false
bootstrap.system_call_filter: false
然后重启elasticsearch就可以了