修改配置文件 /config/elasticsearch.yml
我用两台机器,内网地址分别为230 和 231
处理启动报错一:
[2017-01-12T15:55:55,433][INFO ][o.e.b.BootstrapCheck ] [SfD5sIh] 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 [65530] is too low, increase to at least [262144]
- 临时提高了vm.max_map_count的大小,此操作需要root权限:
sudo sysctl -w vm.max_map_count=262144
sysctl -a|grep vm.max_map_count
- 永久修改vm.max_map_count:
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
处理启动报错二:
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
修改/etc/security/limits.conf文件,添加或修改如下行:
* hard nofile 65536
* soft nofile 65536
处理启动报错三:
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
补:启动异常:ERROR: bootstrap checks failed
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.1默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见 :https://github.com/elastic/elasticsearch/issues/22899
解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
近日,单台机器,8个节点的es集群,8个节点都正常started了,但是就是无法形成集群,后来看日志,日志中出现一堆的MasterNotDiscoveredException这种异常,完整日志如下:
[2016-04-27 15:08:22,445][DEBUG][action.admin.cluster.health] [es.10.16.66.152.0] no known master node, scheduling a retry [2016-04-27 15:08:52,457][INFO ][rest.suppressed ] /_cat/health Params: {h=node.total} MasterNotDiscoveredException[waited for [30s]] at org.elasticsearch.action.support.master.TransportMasterNodeAction$4.onTimeout(TransportMasterNodeAction.java:160) at org.elasticsearch.cluster.ClusterStateObserver$ObserverClusterStateListener.onTimeout(ClusterStateObserver.java:239) at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(InternalClusterService.java:630) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
查看了每一个节点的elasticsearch.yml这个文件之后,发现其中只有一个节点的node.master这个配置为true,而其中discovery.zen.minimum_master_nodes这个配置的值却是5,而有资格成为主节点的只有一个,所以永远也形成不了集群啊。
结果就是要么把其他节点的node.master都设置为true,要么discovery.zen.minimum_master_nodes将这个配置改为1。
错误的解决办法均是从网上扒的,看官就不要吐槽了 虽然官网都有相关说明,但有现成的就不愿意看英文文档,谁叫英文不好呢