(二)解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题

elasticsearch从入门到深入 专栏收录该内容
2 篇文章 0 订阅

(二)解决elasticsearch配置network.host: 0.0.0.0导致elasticsearch服务启动不成功的问题

一、问题概述

本人在本地的虚拟机linux上安装的elasticsearch。

当修改 elasticsearch.yml 文件的 network.host: 0.0.0.0 时,引起了一系列异常,导致服务无法成功启动。

 network.host: 0.0.0.0

引起的问题: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]

解决方案

vim /etc/security/limits.conf文件,添加以以下两行即可解决

* soft nofile 65535
* hard nofile 65535

异常2

异常日志

[2]: max number of threads [3818] for user [admin] is too low, increase to at least [4096]

解决方案

vim /etc/security/limits.conf文件,添加以下两行即可解决

* soft nproc  4096
* hard nproc  4096

异常3

异常日志

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

解决方案

vim /etc/sysctl.conf 文件,添加以下一行即可解决,注意,这里配置完之后需要重启一下linux,否则不一定起效果

 vm.max_map_count=262144  

异常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

解决方案

vim /usr/local/elasticsearch/elasticsearch-7.0.0/config/elasticsearch.yml 文件,添加一下行即可解决

cluster.initial_master_nodes: ["node-1"]
评论 6 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:1024 设计师:我叫白小胖 返回首页

打赏作者

likaihai918

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值