连接被拒绝 Elasticsearch 2.2

Connection Refused Elasticsearch 2.2

我在我的数字海洋上安装了 ES 2.2 droplet.My ES 配置文件如下所示

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
 network.host: "My Droplet Ip address"
 network.bind_host: 127.0.0.1
 http.publish_port: 9200
 http.port: 9200
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# http.cors.enabled: true
#http.cors.allow-origin: "*"

# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>

现在,当我尝试 curl -XGET localhost:9200 时,它可以正常工作,但是当我尝试从远程访问我的 ES 时,“http://IpAddress:9200 也给了我 CONNECTION REFUSED 也 curl -XGET IPAddress:9200 给我连接被拒绝

这在 ES 1.4 上运行良好,但在 2.X 上它开始给我带来连接问题

你有两个解决方案:

一个。您可以将 network.bind_host 更改为您的 public IP 地址

乙。您删除 network.bind_host 并只保留 network.host 和您的 public IP 地址。后者会将 network.bind_hostnetwork.publish_host 都设置为您的 public IP 地址。

还要确保删除行首的所有空格。