elasticsearch开启外网访问

默认情况下,Elastic 只允许本机访问,如果需要远程访问,可以修改 Elastic 安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成0.0.0.0,然后重新启动 Elastic。

network.host: 0.0.0.0

上面代码中,设成0.0.0.0让任何人都可以访问。线上服务不要这样设置,要设成具体的 IP。

启动失败,检查没有通过,报错

[--18T17::,][INFO ][o.e.b.BootstrapChecks    ] [gFOuNlS] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [] bootstrap checks failed
[]: max file descriptors [] for elasticsearch process is too low, increase to at least [] []: max virtual memory areas vm.max_map_count [] is too low, increase to at least [] []: max file descriptors [] for elasticsearch process is too low, increase to at least []

编辑 /etc/security/limits.conf,追加以下内容;
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效

[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=655360
保存后,执行:

sysctl -p

重新启动,成功。

bin/elasticsearch &

参考文档:http://www.ruanyifeng.com/blog/2017/08/elasticsearch.html

原文地址:https://blog.****.net/feng12345zi/article/details/80367907

上一篇:shell脚本学习第一课


下一篇:RestTemplate