【问题标题】:Connection Refused Elasticsearch 2.2连接被拒绝 Elasticsearch 2.2
【发布时间】:2016-03-11 04:27:26
【问题描述】:

我的数字海洋水滴上安装了我的 ES 2.2。我的 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 给了我 CONNECTION REFUSED

这在 ES 1.4 中运行良好,但在 2.X 中它开始出现连接问题

【问题讨论】:

  • 尝试删除network.bind_host,只保留network.host与您的公共IP地址。
  • 成功了。以前我也这样做过,但没有发布我的端口

标签: curl elasticsearch connection-refused


【解决方案1】:

您有两种解决方案:

A.你可以把network.bind_host改成你的公网IP地址

B.您删除 network.bind_host 并仅保留 network.host 与您的公共 IP 地址。后者会将network.bind_hostnetwork.publish_host 都设置为您的公共IP 地址。

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

【讨论】:

  • 现在它可以工作了,但是当我在下面添加 http.cors.enabled:true 和 http.cors.allowed.origin:"*" ES 不会重新启动 Mar 11 00:03:03 ubuntu-1gb- sfo1-01 elasticsearch[9710]:预期 ,但发现 BlockMappingStart Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]:在“阅读器”中,第 67 行,第 3 列:00 年 3 月 11 日:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: http.cors.enabled: true Mar 11 00:03:03 ubuntu-1gb-sfo1-01 elasticsearch[9710]: ^
  • 你最好用你得到的跟踪来更新你的问题,它比 cmets 更容易阅读。
猜你喜欢
  • 2020-09-08
  • 2015-01-21
  • 2018-11-23
  • 1970-01-01
  • 2017-08-08
  • 2017-10-05
  • 1970-01-01
  • 2018-12-02
  • 1970-01-01
相关资源
最近更新 更多