• Register
0 votes
1.7k 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
https://vslevitrav.com/ - generic levitra for sale

Related questions

1 vote
1 answer 626 views
626 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
0 votes
1 answer 4 views
4 views
Problem: Is there anyone to helo on > 'connect to host localhost port 22 connection refused' ?
asked Mar 18 sadi1982 36.3k points
0 votes
1 answer 2 views
2 views
Question: During my training, I'm working on a website and we use Ruby on Rails. We need to send mails to users so I created a mailer. I have tried to put the smtp in both development.rb and environment.rb config.action_mailer.default_url_options = {host: '0.0.0. ... my settings. I also saw that it might be related to my ssh key not being authorized by the server. Do know what is wrong?
asked 4 days ago Atik03 10.1k points
0 votes
1 answer 4 views
4 views
Problem: What caused the error, " Error: failed to connect to 127.0.0.1 port 9050: connection refused " ?
asked 3 days ago salim1 39k points
0 votes
1 answer 5 views
5 views
Problem: When I encountered this problem, I attempted to find a solution on the internet but was unable to find any useful details. If you read the above query and understand what the solution is, please cooperate with me- Thanks.
asked Apr 1 rakib1 51.5k points
1 vote
1 answer 215 views
215 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 3 views
3 views
Problem: I will request someone to answer my question Please, I have searched on the web but I got no useful information for this, now I am in difficulty continuing my learning
asked Mar 22 sadi1982 36.3k points
0 votes
1 answer 2 views
2 views
Problem: This url 'http://profile.myspace.com/index.cfm?fuseaction=user.viewProfile&friendID=39726387' works perfectly well in a browser but cURL return's error 3 (malformed url). Any ideas on a work around? EDIT: cURL code: function get_web_page( $url ) { $options = array( ... = curl_getinfo( $ch ); curl_close( $ch ); if (!$errmsg =='') {die($err.':'.$errmsg);} return $content; }
asked 1 day ago munim01 12.9k points