jplana / python-etcd

A python client for etcd
Other
520 stars 210 forks source link

Client() with srv_domain queries localhost #198

Closed akuzminsky closed 7 years ago

akuzminsky commented 8 years ago

I created Client with srv_domain:

client = etcd.Client(srv_domain='twindb.com')

However client.machines requests http://127.0.0.1:4001/v2/machines.

DNS is configured correctly:

$ dig +noall +answer SRV _etcd-client._tcp.twindb.com
_etcd-client._tcp.twindb.com. 300 IN    SRV     0 0 2379 etcd-1e1650524ba511e68a9b12cb523caae1.twindb.com.
_etcd-client._tcp.twindb.com. 300 IN    SRV     0 0 2379 etcd-6794c99e4ba411e68a9b12cb523caae1.twindb.com.
_etcd-client._tcp.twindb.com. 300 IN    SRV     0 0 2379 etcd-c3e9dea04ba411e68a9b12cb523caae1.twindb.com.
lavagetto commented 7 years ago

@akuzminsky can I see the code snippet of your client initialization? I've used srv domains multiple times and never happened to stumble upon such an issue.

althalus commented 7 years ago

I just ran into this too - looks like python-etcd is querying _etcd instead of _etcd-client when using srv records.

lavagetto commented 7 years ago

yup, I did that in order to be in sync with what confd is doing.

akuzminsky commented 7 years ago

Why not to be in sync with the official docs?

To help clients discover the etcd cluster, the following DNS SRV records are looked up in the listed order:

_etcd-client._tcp.example.com _etcd-client-ssl._tcp.example.com