• Register
0 votes
1.3k 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

Please log in or register to answer this question.

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 508 views
508 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 139 views
139 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 553 views
553 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, 2020 jwilliam 3.9k points
0 votes
2 answers 344 views
344 views
Problem : I am often facing the below error when I want to Debug from my Eclipse IDE. Message: “Failed to connect to remote VM. Connection Refused” How can I fix this error?
asked Jan 8, 2020 alecxe 7.5k points
1 vote
2 answers 230 views
230 views
Problem : Is there anything I can do to solve the following problem? unable to connect to upstart: failed to connect to socket /com/ubuntu/upstart: connection refused
asked Nov 11, 2019 peterlaw 6.9k points
0 votes
1 answer 10 views
10 views
Can anybody help me out with this issue?
asked Jan 3 TeamScript 9.5k points
0 votes
2 answers 1.2K views
1.2K views
Problem : I am facing below error every time : javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused: connect at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1706) at ... I am unable to understand the error why this is happening to my code. Please let me know how to fix above error.
asked Feb 3, 2020 jwilliam 3.9k points
0 votes
1 answer 53 views
53 views
Problem : I am getting bellow Wordpress error download failed. error:0d0890a1:asn1 encoding routines:asn1_verify:unknown message digest algorithm
asked Nov 7, 2019 peterlaw 6.9k points