# Elasticsearch error: curl: (7) Failed to connect to localhost port 9200: Connection refused

**URL:** <https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313>\
**Category:** Elasticsearch\
**Created:** [December 2, 2020, 7:18am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313 "2020-12-02T07:18:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![webapps](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/webapps/32/77617_2.png) [@webapps](https://discuss.elastic.co/u/webapps)\
**Post date:** [December 2, 2020, 7:18am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/1 "2020-12-02T07:18:31Z")

</div>

I installed the elasticsearch in my local but when I tried to access this command `curl -X GET http://localhost:9200/` it's giving me the error that the connection was refused.

```
curl: (7) Failed to connect to localhost port 9200: Connection refused

```

Please what's wrong with curl?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 2, 2020, 7:40am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/2 "2020-12-02T07:40:38Z")

</div>

There is not a lot of information to go on here. Which version did you install? How is it configured? How did you install it? Is there anything in the Elasticsearch logs?

---

<div class="post-metadata">

**Author:** ![webapps](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/webapps/32/77617_2.png) [@webapps](https://discuss.elastic.co/u/webapps)\
**Post date:** [December 2, 2020, 8:33am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/3 "2020-12-02T08:33:21Z")

</div>

I had installed 7.1.0 elasticsearch version

Here is the screenshot of elasticsearch.yml

'cluster.name: ACM\_STG\_Cluster  
node.name: pvg03s1acmes01  
https.bind\_host: 10.120.21.178  
path.data: /elasticdata/data  
path.logs: /elasticlogs/logs  
network.host: 0.0.0.0  
cluster.initial\_master\_nodes: ["sjc04s1ctres01"]  
discovery.seed\_hosts: ["10.120.21.178"]  
opendistro\_security.nodes\_dn:

- 'CN=pvg03s1acmes\*''

I installed by these instructions: [https://www.elastic.co/guide/en/elasticsearch/reference/current/brew.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/brew.html)

I do have a lot of files in logs. do you want me to upload the logs as well?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 2, 2020, 8:38am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/4 "2020-12-02T08:38:45Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [December 2, 2020, 8:39am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/5 "2020-12-02T08:39:26Z")

</div>

```auto
opendistro_security.nodes_dn:

```

Note that we don't support the distribution/this plugin you are using here.

---

<div class="post-metadata">

**Author:** ![webapps](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/webapps/32/77617_2.png) [@webapps](https://discuss.elastic.co/u/webapps)\
**Post date:** [December 2, 2020, 8:51am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/6 "2020-12-02T08:51:01Z")

</div>

Thanks @dadoonet. BTW May I know since which elasticsearch version have they stopped supporting the above distribution?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [December 2, 2020, 9:01am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/7 "2020-12-02T09:01:40Z")

</div>

OpenDistro has never been supported here and they have their own forum. I do suspect your issue is that you have configured you http host to not listen to localhost.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 30, 2020, 9:01am UTC](https://discuss.elastic.co/t/elasticsearch-error-curl-7-failed-to-connect-to-localhost-port-9200-connection-refused/257313/8 "2020-12-30T09:01:52Z")

</div>

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