Skip to content

Failed connect to localhost:9200; Connection refused

I installed Elasticsearch, but each time I tried to check the status I get the error

“curl: (7) Failed connect to localhost:9200; Connection refused”

I then installed FirewallD and added port 9200, but it was still not connecting. I disabled FirewallD to make sure it’s the one causing the problem and I realized that I was getting the same error even when FirewallD is disabled.

I also noticed that when I run the command to add port 9200 and save it with the commands below…

iptables -I INPUT -p tcp --dport 9200 --syn -j ACCEPT
iptables -I INPUT -p udp --dport 9200 -j ACCEPT
iptables-save

Then I checked with

iptables --list

The port 9200 was not shwing in the list

And I also checked Elasticsearch status again with…

curl -XGET 'localhost:9200'

I still get the error “curl: (7) Failed connect to localhost:9200; Connection refused

Any suggestions?

Thanks!