我正在运行Elasticsearch 1.3.4,它是通过Homebrew在Mac OS X 10.10上新安装的:
$ brew install elasticsearch
$ elasticsearch在浏览器中运行http://localhost:9200/_cluster/state成功:
{
"cluster_name": "elasticsearch_jbrukh",
"version": 2,
"master_node": "q6Jzcza_RwaVvc_1u95O1Q",
"blocks": {},
"nodes": {
"q6Jzcza_RwaVvc_1u95O1Q": {
"name": "Ethan Edwards",
"transport_address": "inet[/127.0.0.1:9300]",
"attributes": {}
}
},
"metadata": {
"templates": {},
"indices": {}
},
"routing_table": {
"indices": {}
},
"routing_nodes": {
"unassigned": [],
"nodes": {
"q6Jzcza_RwaVvc_1u95O1Q": []
}
},
"allocations": []
}但是,以下curl命令失败:
$ curl -XGET "http://localhost:9200/_cluster/state"
curl: (7) Failed to connect to localhost port 9200: Connection refused此外,curl命令会间歇性地成功,但只有在浏览器命中该URL之后,它才会工作一次,然后再次失败,并显示上述错误。
我怎么才能修复它呢?
发布于 2015-01-15 16:32:28
正如我之前回答的一个类似的问题,here。在我的Mac上,我使用127.0.0.1:9200/而不是http://localhost:9200/,因为我也有同样的问题。
我认为当您使用该命令时,终端会将本地主机替换为它的IPv6地址,我不确定curl是否支持这一点。
请查收并通知我。
发布于 2015-02-09 03:50:04
我也有同样的问题(OSX10.10& ES 1.3.4)。
快速的解决方案是强制curl在--ipv4中使用IPv4
curl --ipv4 -XGET "http://localhost:9200/_cluster/state"(至少对我来说是这样的)
永久的解决方案是编辑/etc/hosts并注释掉这一行
#fe80::1%lo0 localhost发布于 2016-10-13 22:19:02
我得到了类似的问题,但似乎是另一种情况。
Elasticsearch似乎在监听ipv6,但没有监听ipv4。为了强制我的客户机与它对话(在我的例子中是节点js驱动程序1),我发现ipv6本地主机的符号是唯一的方法:http://[::1]:9200。
https://stackoverflow.com/questions/27953770
复制相似问题