ElasticSearch Linux环境启动常见问题

启动失败报错如下:

[2019-06-28T09:59:09,262][ERROR][o.e.b.Bootstrap          ] [node1] node validation exception
[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]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[2019-06-28T09:59:09,318][INFO ][o.e.n.Node               ] [node1] stopping ...
[2019-06-28T09:59:09,372][INFO ][o.e.n.Node               ] [node1] stopped
[2019-06-28T09:59:09,373][INFO ][o.e.n.Node               ] [node1] closing ...
[2019-06-28T09:59:09,384][INFO ][o.e.n.Node               ] [node1] closed
[2019-06-28T09:59:09,387][INFO ][o.e.x.m.p.NativeController] [node1] Native controller process has stopped - no new native processes can be started

问题1:max file descriptors [4096] for elasticsearch process is too low...
原因:

[baozhe@localhost ~]$ ulimit -Hn
4096
[baozhe@localhost ~]$ ulimit -Sn
1024
[baozhe@localhost ~]$ 

解决办法:
/etc/security/limits.conf
添加如下内容:

* soft nofile 65535
* hard nofile 65535

重新登录系统后生效

[baozhe@localhost ~]$ ulimit -Hn
65535
[baozhe@localhost ~]$ ulimit -Sn
65535

问题2:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

/etc/sysctl.conf
添加下面配置:
vm.max_map_count=262144
并执行命令:
sysctl -p

问题3:[3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
解决办法:
配置文件中指定cluster.initial_master_nodes或者在启动参数中指定,如下:

bin/elasticsearch -E network.host=192.168.3.22 -E node.name=node1 -E cluster.name=geektime -E path.data=node1_data -E cluster.initial_master_nodes=node1 -d

关于discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes更详细信息可以查询官方文档

你可能感兴趣的:(ElasticSearch Linux环境启动常见问题)