解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题
解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题一、问题概述本人在本地的虚拟机linux上安装的elasticsearch。当修改 elasticsearch.yml 文件的 network.host: 0.0.0.0 时,引起了一系列异常,导致服务无法成功启动。network.host: 0.0.0.01引起的问题:e
解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题
一、问题概述
本人在本地的虚拟机linux上安装的elasticsearch。
当修改 elasticsearch.yml 文件的 network.host: 0.0.0.0 时,引起了一系列异常,导致服务无法成功启动。
network.host: 0.0.0.0
1
引起的问题:elasticsearch服务进程启动一会之后,通过jps命令查看到进程关闭,命令行不提示错误。打开另一个命令行窗口,输入 curl 127.0.0.1:9200 提示 curl: (7) couldn’t connect to host 错误。
二、解决思路
elasticsearch下有个logs包,里面有个elasticsearch.log 日志文件,可查看错误日志排查问题。
错误日志如下:
9-04-26T03:28:02,929][DEBUG][o.e.a.ActionModule ] [localhost.localdomain] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-04-26T03:28:03,778][INFO ][o.e.d.DiscoveryModule ] [localhost.localdomain] using discovery type [zen] and seed hosts providers [settings]
[2019-04-26T03:28:05,374][INFO ][o.e.n.Node ] [localhost.localdomain] initialized
[2019-04-26T03:28:05,374][INFO ][o.e.n.Node ] [localhost.localdomain] starting ...
[2019-04-26T03:28:05,856][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address {192.168.33.121:9300}, bound_addresses {192.168.33.121:9300}
[2019-04-26T03:28:05,862][INFO ][o.e.b.BootstrapChecks ] [localhost.localdomain] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-04-26T03:28:05,915][ERROR][o.e.b.Bootstrap ] [localhost.localdomain] node validation exception
[4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [3818] for user [admin] 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]: 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-04-26T03:28:05,928][INFO ][o.e.n.Node ] [localhost.localdomain] stopping ...
[2019-04-26T03:28:05,939][INFO ][o.e.n.Node ] [localhost.localdomain] stopped
[2019-04-26T03:28:05,940][INFO ][o.e.n.Node ] [localhost.localdomain] closing ...
[2019-04-26T03:28:05,955][INFO ][o.e.n.Node ] [localhost.localdomain] closed
[2019-04-26T03:28:05,956][INFO ][o.e.x.m.p.NativeController] [localhost.localdomain] Native controller process has stopped - no new native processes can be started
主要关注以下错误日志
异常1:
异常日志
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
1
2
解决方案
vim /etc/security/limits.conf文件,添加以以下两行即可解决
* soft nofile 65535
* hard nofile 65535
1
2
异常2
异常日志
[2]: max number of threads [3818] for user [admin] is too low, increase to at least [4096]
1
解决方案
vim /etc/security/limits.conf文件,添加以下两行即可解决
* soft nproc 4096
* hard nproc 4096
1
2
异常3
异常日志
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
1
解决方案
vim /etc/sysctl.conf 文件,添加以下一行即可解决,注意,这里配置完之后需要重启一下linux,否则不一定起效果
vm.max_map_count=262144
1
异常4
错误日志
[4]: 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
1
解决方案
vim /usr/local/elasticsearch/elasticsearch-7.0.0/config/elasticsearch.yml 文件,添加一下行即可解决
原文链接:https://blog.csdn.net/lixiaohai_918/article/details/89569611
更多推荐
所有评论(0)