我们在Linux下成功安装ElasticSearch后,能成功通过 curl 'http://localhost:9200' 对elasticsearch 进行访问。但在外网环境下却不能访问。解决这一问题 我们需要做以下配置
1. 在vim config/elasticsearch.yml 添加如下内容
network.host: 0.0.0.0
重启服务
如果出现node validation exception bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 那么
2. 切换root账户 vim /etc/sysctl.conf
增加一行 vm.max_map_count=655360
接着执行 sysctl -p
然后切换用户 重启es服务
如果出现 max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536] 错误 那么
3. vim /etc/security/limits.conf
修改原内容为
root soft nofile 65536
root hard nofile 131072
* soft nofile 2048
* hard nofile 131072
然后保存退出 切换用户 重启es服务
如果出现 JVM is using the client VM [Java HotSpot(TM) Client VM] but should be using a server VM for the best performance 错误 那么
4.进入jdk的安装目录 比如我的是 cd /usr/local/jdk1.8.0_172/jre/lib/i386
vim jvm.cfg 修改里面的内容为
-server KNOWN(相当于把第二行的内容移到第一行)
-client IF_SERVER_CLASS -server
-minimal KNOWN
然后保存退出 切换用户重启es服务
发现可以正常启动,然后在外网进行访问时 可以正常访问

本文档详细介绍了在Linux环境下,ElasticSearch安装后如何配置以允许外网访问。步骤包括修改`elasticsearch.yml`设置`network.host`为`0.0.0.0`,调整`sysctl.conf`中的`vm.max_map_count`,更新`limits.conf`以提升文件描述符限制,以及在JDK配置中启用服务器JVM。完成这些步骤后,ElasticSearch将能够成功接受外网连接。

3381

被折叠的 条评论
为什么被折叠?



