# Connection refused and timed out error

**URL:** <https://discuss.elastic.co/t/connection-refused-and-timed-out-error/94224>\
**Category:** Elasticsearch\
**Created:** [July 23, 2017, 4:30am UTC](https://discuss.elastic.co/t/connection-refused-and-timed-out-error/94224 "2017-07-23T04:30:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srikanth\_Bemineni](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@Srikanth\_Bemineni](https://discuss.elastic.co/u/Srikanth_Bemineni)\
**Post date:** [July 23, 2017, 4:30am UTC](https://discuss.elastic.co/t/connection-refused-and-timed-out-error/94224/1 "2017-07-23T04:30:21Z")

</div>

Using elasticsearch 5.4.0 with python library 5.4.0. The initial connection gets established fine, any add requests later ends up with a connection refused error. Updated elasticsearch to 5.5.0 and I am still seeing the same issue. Kibana(5.5.0) shows an error that it is not compatible with 5.4.0, after updating to elasticsearch 5.5.0 Kibana error message was showing as "Elasticsearch is still initializing the kibana index."

Had to clear the data directory and start fresh and everything worked fine. Now I am not able migrate to my old data.

How do I fix this. I verified the connection, and I am able to send HTTP requests using CURL and properly getting back responses.

curl -XGET [http://localhost:9200/\_cat/indices?v](http://localhost:9200/_cat/indices?v)  
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size  
yellow open medicscity 2P\_M0bZHQIWOXVzbbVl8mA 5 1 1 0 6.1kb 6.1kb  
red open .kibana dlmUMgW4S2-jfUr1n3bRow 1 1  
yellow open eldam l0WvZmPcQQaopVbj8UEFvQ 5 1 0 0 955b 955b

Traceback (most recent call last):  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/elasticsearch/connection/http\_urllib3.py", line 114, in perform\_request  
response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, \*\*kw)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen  
\_stacktrace=sys.exc\_info()[2])  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/util/retry.py", line 333, in increment  
raise six.reraise(type(error), error, \_stacktrace)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise  
raise value  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen  
chunked=chunked)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 357, in \_make\_request  
conn.request(method, url, \*\*httplib\_request\_kw)  
File "/usr/lib/python3.5/http/client.py", line 1106, in request  
self.\_send\_request(method, url, body, headers)  
File "/usr/lib/python3.5/http/client.py", line 1151, in \_send\_request  
self.endheaders(body)  
File "/usr/lib/python3.5/http/client.py", line 1102, in endheaders  
self.\_send\_output(message\_body)  
File "/usr/lib/python3.5/http/client.py", line 934, in \_send\_output  
self.send(msg)  
File "/usr/lib/python3.5/http/client.py", line 877, in send  
self.connect()  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connection.py", line 166, in connect  
conn = self.\_new\_conn()  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connection.py", line 150, in \_new\_conn  
self, "Failed to establish a new connection: %s" % e)  
urllib3.exceptions.NewConnectionError: \<urllib3.connection.HTTPConnection object at 0x7f4cffd29358\>: Failed to establish a new connection: [Errno 111] Connection refused

response = self.pool.urlopen(method, url, body, retries=False, headers=self.headers, \*\*kw)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen  
\_stacktrace=sys.exc\_info()[2])  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/util/retry.py", line 333, in increment  
raise six.reraise(type(error), error, \_stacktrace)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/packages/six.py", line 686, in reraise  
raise value  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen  
chunked=chunked)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 389, in \_make\_request  
self.\_raise\_timeout(err=e, url=url, timeout\_value=read\_timeout)  
File "/home/ekam/devel/medics\_city/lib/python3.5/site-packages/urllib3/connectionpool.py", line 309, in \_raise\_timeout  
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout\_value)  
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='127.0.0.1', port=9200): Read timed out. (read timeout=10)

---

<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:** [August 20, 2017, 4:30am UTC](https://discuss.elastic.co/t/connection-refused-and-timed-out-error/94224/2 "2017-08-20T04:30:56Z")

</div>

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