I am very new to Curl. I have recently started learning Curl.
Whenever I try to connect to the Elasticsearch using the below command
curl http://localhost:9200 it is working properly.
But when I try to run the following command curl http://IpAddress:9200 it is showing me below error
“Curl: (7) failed to connect to localhost port 9200: connection refused”
How can I resolve the above error?
I also had a similar issue in the past refusing the connections on my 9200 port.
So I just checked the elasticsearch service status with the below command
sudo service elasticsearch status.
*After executing above command if it is presenting the error and it is related to Java, then mostly the problem is with your jvm memory.
If you want then you can also edit it in
/etc/elasticsearch/jvm.options. My machine is having 1GB RAM memory on the Amazon environment,
So I kept my configurations as below:*
After setting the above configuration and just restarting my elasticsearch service, it started working properly for me.
If you using the local firewall then Nmap and UFW checking will also be very useful for you.
After that you can test your Elasticsearch node is running or not by sending the HTTP request to the port 9200 on localhost using the command as shown below:
I hope this will solve your problem