更多精彩内容请关注
- 微信公众号:LifeSmile
- 个人网站:www.lifesmile.cn
默认情况下,ES只允许本机访问,如果需要远程访问,可以修改 ES安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成0.0.0.0,然后重新启动ES。
network.host: 0.0.0.0
启动失败的情况下1:
[1]: max file descriptors [65534] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
【1】大概意思就是需要 [65536],你只配置了[65534] ,改下就可以了。
编辑 /etc/security/limits.conf,追加以下内容,有的话就修改为65536,此文件修改后需要重新登录用户,才会生效
* soft nofile 65536
* hard nofile 65536
【2】需要增加到[262144] (若没有报错这个错就不管)
编辑 /etc/sysctl.conf,追加以下内容:
vm.max_map_count=655360 要大于262144
保存后,执行:
sysctl -p
重新启动
启动的情况下2:
ERROR: [1] bootstrap checks failed
[1]: 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】就是说你少配置了些东西
修改配置文件:config/elasticsearch.yml
cluster.name: "my-cluster"
network.host: 0.0.0.0
# custom config
node.name: "node-1"
discovery.seed_hosts: ["127.0.0.1", "[::1]"]
cluster.initial_master_nodes: ["node-1"]
# 开启跨域访问支持,默认为false
http.cors.enabled: true
复制代码重点是 node.name 和 cluster.initial_master_node
重启成功