解决:Elasticsearch外网访问的问题

in ELK问题解决 with 0 comment

一、外网访问问题
默认情况下,是不支持外网访问,如果你的Elasticsearch安装在其他机器上,你从外网去访问的时候,访问不到,不通。
那么需要修改配置。
进入文件夹:

elasticsearch-7.0.0/config$

修改:elasticsearch.yml文件
添加

network.host: 0.0.0.0

二、会报错

ERROR: [2] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2]: 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.针对问题1

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

使用sudo用户修改文件:sudo vim /etc/sysctl.conf

添加一行配置:

vm.max_map_count=655360

查看是否生效:

sudo sysctl -p

2.针对问题2

[2]: 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: ["node-1", "node-2"]

然后就启动elasticsearch,就可以通过外网访问了。

Responses