• Register
0 votes
992 views

Problem :

I am very new to Curl. I have recently started learning Curl.

Whenever I try to connect to the Elasticsearch using 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 above error?

8 4 2
2,300 points

1 Answer

0 votes

Solution :

I also had the 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:

-Xms128m
-Xmx128m

After setting 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:

curl http://localhost:9200
5 2 1
4,980 points

Related questions

1 vote
1 answer 366 views
366 views
Problem : Getting following error related to content-type header {"error":"content-type header [application/x-www-form-urlencoded] is not supported","status":406} How to resolve it?
asked Nov 11, 2019 peterlaw 6.9k points
1 vote
1 answer 101 views
101 views
Problem : I am getting following kubernetes error and dont understand why command line is trying to connect to localhost? the connection to the server localhost:8080 was refused - did you specify the right host or port?
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
1 answer 314 views
314 views
Problem : I am facing below error message Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in I am unable to understand this message. Please let me know how can I fix it?
asked Jan 31 jwilliam 3.9k points