Cannot curl elasticsearch from outside network

Hi guys,

I am new to elasticsearch and my company currently have a project that needs to use elasticsearch, so this issue is quite ... urgent

I have installed elasticsearch 5 via this document
https://www.elastic.co/guide/en/elasticsearch/reference/5.0/rpm.html

We are using centos 6.8, after installing elasticsearch, i have left configurations to the default, allow port 9200 and 9300 by command:

$ sudo iptables -A INPUT -p tcp -m tcp --dport 9200 -j ACCEPT
$ sudo iptables -A INPUT -p tcp -m tcp --dport 9300 -j ACCEPT
$ sudo /etc/init.d/iptables save

then try to connect by curl -XGET 'server_ip:9200/?pretty', it returns connection refused.

I have try to install elasticsearch on centos 7 and it works perfectly, but my company requires install on centos6.8

Any solutions or advises?

Very appreciate !

A few things you can try/check

  • Use netstat to see which IP Elasticsearch binds to (127.0.0.1 or the server IP)
  • Can you do curl on the server itself?
  • Disable iptables completely and try again
  • Does telnet to server_ip 9200 work?

Apart from the suggested debugging above: Making ES publicly accessible generally is a very bad idea. For some background on the reasoning read here (though a bit older, most of the information is still valid and relevant):

Would you mind sharing your use case of why you need public access?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.