Elasticsearch: Failed to connect to localhost port 9200 - Connection refused

chinna2580 picture chinna2580 · Jul 28, 2015 · Viewed 208.7k times · Source

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

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

Failed to connect to localhost port 9200: Connection refused

How to resolve this error?

Answer

Andrew White picture Andrew White · Jul 28, 2015

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.

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