可以远程连接到Elasticsearch 5,但不能连接到本地

时间:2017-11-06 04:21:16

标签: linux elasticsearch elasticsearch-5

我最近从Elasticsearch 1.5升级到Elasticsearch 5.5,我可以远程连接,但不能从localhost连接。

我更新了elasticsearch.yml以便能够远程连接:

network.host: 0.0.0.0

弹性搜索日志对我来说很好看:

[2017-11-05T22:44:23,441][INFO ][o.e.n.Node               ] [node1] starting ...
[2017-11-05T22:44:23,655][INFO ][o.e.t.TransportService   ] [node1] publish_address {[ip address]:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}, {[ip address]:9300}
[2017-11-05T22:44:23,666][INFO ][o.e.b.BootstrapChecks    ] [node1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-11-05T22:44:26,712][INFO ][o.e.c.s.ClusterService   ] [node1] new_master {node1}{s-J7aStjQFuwor-WY6bSCQ}{nv4GVIQ6SwScPiebRHBQBQ}{localhost}{[ip address]:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-11-05T22:44:26,733][INFO ][o.e.h.n.Netty4HttpServerTransport] [node1] publish_address {[ip address]:9200}, bound_addresses {127.0.0.1:9200}, {[::1]:9200}, {[ip address]:9200}
[2017-11-05T22:44:26,734][INFO ][o.e.n.Node               ] [node1] started

我想知道它是否与代理有关,因为当我尝试运行curl localhost:9200时,我得到以下内容:

...
<p>The following error was encountered while trying to retrieve the URL: <a href="http://localhost:9200/">http://localhost:9200/</a></p>

<blockquote id="error">
<p><b>Connection to 127.0.0.1 failed.</b></p>
</blockquote>

<p id="sysmsg">The system returned: <i>(111) Connection refused</i></p>

<p>The remote host or network may be down. Please try the request again.</p>
...

有关如何缩小问题范围的任何想法或提示都会有所帮助。

1 个答案:

答案 0 :(得分:0)

结果发现了一个http_proxy bash变量,它代理了所有出站流量。一旦取消设置此变量,curl命令就会起作用。

事实证明,在进行此修复之前,我意识到我们的Java应用程序仍然可以在本地连接到Elasticsearch,这只是curl命令无法正常工作。