Closed tobegit3hub closed 7 years ago
@tobegit3hub you can either pass a tuple of (host, port) tuples to python-etcd, or if you can set up a SRV record on your DNS, you can use the srv_domain variable:
so if you set up a SRV record for etcd._tcp.mydomain.com
to list all of your etcd servers, you can then connect to the cluster as follows:
c = etcd.Client(srv_domain='mydomain.com')
And even if you pass to python-etcd one server, you can just set allow_reconnect=True and the library will fetch the list of etcd members from the cluster, and reconnect automatically upon failure.
Thanks @lavagetto and the tuple of (host, port)
is actually what we wants. I have found the usage in https://github.com/jplana/python-etcd/blob/master/src/etcd/client.py#L75 . It would be great if we have some document about this.
Moreover, allow_reconnect=True
is really helpful, too. 👍
Now we can connect with etcd with single ip and port.
Is it possible to connect with etcd cluster with multiple IPs and ports? It's really reasonable because we may reconnect with another etcd instance even when one instance is down.