解决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.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
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值