Elasticsearch:无法连接到本地主机端口9200-连接被拒绝

Elasticsearch:无法连接到本地主机端口9200-连接被拒绝

问题描述:

当我尝试使用
curl http:// localhost:9200 连接到Elasticsearch时,它工作正常。

When I tried connecting to Elasticsearch using the curl http://localhost:9200 it is working fine.

但是当我运行 curl http:// IpAddress:9200 时,它会抛出一个错误,说

But when I run the curl http://IpAddress:9200 it is throwing an error saying


无法连接到本地主机端口9200:连接被拒绝

Failed to connect to localhost port 9200: Connection refused

如何解决此错误? / p>

How to resolve this error?

默认情况下,它应绑定到所有本地地址。因此,假设您的防火墙没有网络层问题,我认为可以检查的唯一ES设置是 network.bind_host 并确保未设置或设置为 0.0.0.0 :: 0 或网络的正确IP地址。

By default it should bind to all local addresses. So, assuming you don't have a network layer issue with firewalls, the only ES setting I can think to check is network.bind_host and make sure it is either not set or is set to 0.0.0.0 or ::0 or to the correct IP address for your network.

更新:根据ES 2.3中的注释,您应该设置 network.host

Update: per comments in ES 2.3 you should set network.host instead.