[elasticsearch-py] problem with connection

We're using elastic py from elastic 0.9 and we recently migrate to 5.2
We used to create a connection this way:
elasticsearch_server = ('') es = elasticsearch.Elasticsearch(elasticsearch_server, timeout=10, retry_on_timeout=True, sniff_on_start=False, sniff_on_connection_fail=True, sniff_timeout=10, serializer=JSONSerializerPython2(), sniffer_timeout=30)

Everything is working correctly until I add a new server that doesn't yet exist.

elasticsearch_server = ('') ---> elasticsearch_server = ('', '')

Then it raise a TransportError: TransportError(N/A, 'Unable to sniff hosts - no viable hosts found.')
If I remove the 1234 ip I can connect without problem.

What wrong? if I have 2 serves and I lost one, I can no more run with only one server???

This one was working perfectly with previous version so maybe because of new option?
I checked the doc but found nothing!

If somebody have a tip.

And another things: If I set sniff_on_start=True it raise a TransportError

I return debugging!

Here more information:

I put some debug in transport.py/sniff_hosts()

Here the list of the host sniffed which is correct (1234 Ip doesn't exist):
[{u'transport_address': u'', u'name': u'banana-node-1', u'roles': [u'master', u'data', u'ingest'], u'ip': u'', u'host': u'', u'version': u'5.2.2', u'build_hash': u'f9d9b74'}]

But after in the code he try to read the IP with the following key: "http_address"

And this key is not in the dict so it return a list of empty hosts??!!!! :cry:

Something wrong with my configuration need to set somewhere the transport protocol?

Dive back in the doc and debug.

========================= EDIT ======================

I figure out that the elasticsearch lib was not up to date :disappointed:
So I upgrade to the last version 5.2 (previously 5.0.1)

But my problem is still not solved, I set the timeout to 2 sec.

If the 2 servers are on, no problem, but If I switch off one, on each request I have a latency (~> timeout) and in my log this error:

ConnectTimeoutError: (<urllib3.connection.HTTPConnection object at 0x7f515c575390>, u'Connection to timed out. (connect timeout=2)')
WARNING:elasticsearch:Connection <Urllib3HttpConnection:> has failed for 1 times in a row, putting on 60 second timeout.

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