I am trying to send data to ealasticsearch remotely (from a
different droplet). In the python code I am using there is a call to
something in the python elasticsearch module that looks like this:

es = Elasticsearch([{‘host’:’http://139.59.255.61’,'port’:9200}])

where 139.59.255.61 is the address of the droplet running elasticsearch.

But this does not seem to work. I have tried other ways of doing it but
they are not working.
On the other hand running this from the remote host does seem to connect
curl http://139.59.255.61:9200/

Here is the error message
Traceback (most recent call last):
File “T2Remote.py”, line 108, in <module>
stream.filter(locations=GEOBOXWORLD)
File
“/root/.pyenv/versions/2.7.10/lib/python2.7/site-packages/tweepy/streaming.py”,
line 445, in filter
self.
start(async)
File
“/root/.pyenv/versions/2.7.10/lib/python2.7/site-packages/tweepy/streaming.py”,
line 361, in start
self.
run()
File
“/root/.pyenv/versions/2.7.10/lib/python2.7/site-packages/tweepy/streaming.py”,
line 294, in _run
raise exception
elasticsearch.exceptions.ConnectionError:
ConnectionError(<urllib3.connection.HTTPConnection object at
0x7f2ae85aefd0>: Failed to establish a new connection: [Errno -2] Name or
service not known) caused by:
NewConnectionError(<urllib3.connection.HTTPConnection object at
0x7f2ae85aefd0>: Failed to establish a new connection: [Errno -2] Name or
service not known)
root@elk:/usr/bin#

1 comment
  • I restarted Elasticsearch and now the error is
    Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.VerifiedHTTPSConnection object at 0x7f31ba21bfd0>: Failed to establish a new connection: [Errno 111] Connection refused)

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @willie108,

It looks like your elastic search instance is either listening only on localhost (127.0.0.1) or perhaps not running correctly. The easiest way to check would just be to update your configuration to connect to 127.0.0.1:9200. If you don’t have luck using that then check to see if the process is running, and if not, check the logs, and try to start it by hand to get it running. Let us know if this helps, and if you need any further information.

Submit an Answer