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

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?


  • make sure your port with sudo nano /etc/elasticsearch/elasticsearch.yml.
    – S.P
    May 11, 2022 at 6:52
  • change different port and try.
    – S.P
    May 11, 2022 at 6:52

1 Answer 1


Can you try this way?

curl -XGET 'http://localhost:9200'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.