I'm running Elasticsearch 1.3.4, freshly installed on Mac OS X 10.10 via Homebrew:
$ brew install elasticsearch
$ elasticsearch
Running http://localhost:9200/_cluster/state
in the browser succeeds:
{
"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": []
}
However, the following curl command fails:
$ curl -XGET "http://localhost:9200/_cluster/state"
curl: (7) Failed to connect to localhost port 9200: Connection refused
Moreover, the curl command succeeds intermittently, but only AFTER that URL is hit from the browser, then it works one time and then starts to fail again with the above error.
How can I fix that ?
As I answered before on a similar question here. On my Mac OS X, I use 127.0.0.1:9200/ instead of http://localhost:9200/ cause I had the same problem.
I think that when you use the command the terminal replaces the localhost by it's IPv6 address and I'm not sure that curl supports that.
Please check and let me know.
I had the same problem (OS X 10.10 & ES 1.3.4).
Quick solution is to force curl to use IPv4 with --ipv4
curl --ipv4 -XGET "http://localhost:9200/_cluster/state"
(at least for me it worked)
Permanent solution is to edit /etc/hosts
and comment out this line
#fe80::1%lo0 localhost
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With