| 2017年3月16日
部署完成ES之后,如果我们不修改配置,那么默认只有本机可以访问ES的api接口,如果需要给外部机器访问,那么就需要修改ES的配置了。
在默认情况下,ES只允许本地访问api接口,如果我们希望在另外一台机器上访问ES的接口的话,需要配置主机地址:
/data/elasticsearch-5.2.2> vim config/elasticsearch.yml
#network.host: 192.168.0.1
network.host: 10.140.7.12
保存退出,重新启动es,一般都会报错,无法启动
[2017-03-16T10:51:23,168][INFO ][o.e.t.TransportService ] [DwX_4EG] publish_address {10.140.7.12:9300}, bound_addresses {10.140.7.12:9300}
[2017-03-16T10:51:23,176][INFO ][o.e.b.BootstrapChecks ] [DwX_4EG] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65536] is too low, increase to at least [262144]
对于这个错误,需要这样处理,执行下面的命令,或者把这个配置/etc/sysctl.conf
sysctl -w vm.max_map_count=262144
再次启动,报下面的错误:
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因: 这是在因为操作系统不支持SecComp,而ES5.2.2默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决: 在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
重启ok 一下是网友遇到的问题,也一并记录一下: 问题一:警告提示
[2016-12-20T22:37:28,543][INFO ][o.e.b.BootstrapCheck ] [elk-node1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2016-12-20T22:37:28,552][ERROR][o.e.b.Bootstrap ] [elk-node1] node validation exception
bootstrap checks failed
max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
[2016-12-20T22:37:28,560][INFO ][o.e.n.Node ] [elk-node1] stopping ...
[2016-12-20T22:37:28,628][INFO ][o.e.n.Node ] [elk-node1] stopped
[2016-12-20T22:37:28,629][INFO ][o.e.n.Node ] [elk-node1] closing ...
[2016-12-20T22:37:28,677][INFO ][o.e.n.Node ] [elk-node1] closed
报了一大串错误,其实只是一个警告。
解决:使用心得linux版本,就不会出现此类问题了。
问题二:ERROR: bootstrap checks failed
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
问题三:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
解决:切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf 修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
问题四:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf 添加下面配置:
vm.max_map_count=655360
# 并执行命令:
sysctl -p
关注「黑光技术」,关注大数据+微服务