python-etcd3 icon indicating copy to clipboard operation
python-etcd3 copied to clipboard

Why not support multi-hosts in etcd v3 client

Open wuji1020 opened this issue 4 years ago • 13 comments

In etcd v2 python client, It is allowed to input multi-hosts to improve the high availability, But in etcd v3 python client, only one host is allowed , anyone knows why?

V3:

class Etcd3Client(object):
    def __init__(self, host='localhost', port=2379,
                 ca_cert=None, cert_key=None, cert_cert=None, timeout=None,
                 user=None, password=None, grpc_options=None):

        self._url = '{host}:{port}'.format(host=host, port=port)
        self.metadata = None

v2:

class Client(object):

    """
    Client for etcd, the distributed log service using raft.
    """

    _MGET = 'GET'
    _MPUT = 'PUT'
    _MPOST = 'POST'
    _MDELETE = 'DELETE'
    _comparison_conditions = set(('prevValue', 'prevIndex', 'prevExist', 'refresh'))
    _read_options = set(('recursive', 'wait', 'waitIndex', 'sorted', 'quorum'))
    _del_conditions = set(('prevValue', 'prevIndex'))

    http = None

    def __init__(
            self,
            host='127.0.0.1',
            port=4001,
            srv_domain=None,
            version_prefix='/v2',
            read_timeout=60,
            allow_redirect=True,
            protocol='http',
            cert=None,
            ca_cert=None,
            username=None,
            password=None,
            allow_reconnect=False,
            use_proxies=False,
            expected_cluster_id=None,
            per_host_pool_size=10,
            lock_prefix="/_locks"
    ):
        """
        Initialize the client.

        Args:
            host (mixed):
                           If a string, IP to connect to.
                           **If a tuple ((host, port), (host, port), ...)**

            port (int):  Port used to connect to etcd.

wuji1020 avatar Aug 03 '20 03:08 wuji1020

Hello, can you tell me the version number containing V2. thanks!

qtccz avatar Aug 06 '20 02:08 qtccz

Hello, can you tell me the version number containing V2. thanks!

The package of etcd v2 python client here: https://pypi.org/project/python-etcd/ The source codes here: https://github.com/jplana/python-etcd/blob/master/src/etcd/client.py

wuji1020 avatar Aug 06 '20 09:08 wuji1020

+1

ghostbody avatar Aug 14 '20 09:08 ghostbody

+1 need it

njuicsgz avatar Aug 21 '20 09:08 njuicsgz

what's wrong with #106, it's something really useful

casper-lc avatar Aug 24 '20 03:08 casper-lc

what's wrong with #106, it's something really useful

But that doesn't solve the problem

chryseosTang avatar Jan 25 '21 09:01 chryseosTang

Any progress on this feature? Domain with multiple IP addresses doesn't work either, address is resolved once client is created.

EmptyLungs avatar Apr 15 '21 04:04 EmptyLungs

Any progress on this feature?

zhangguanzhang avatar Dec 07 '21 08:12 zhangguanzhang

+1 need this!

nagylzs avatar Apr 16 '22 15:04 nagylzs

when release i can see its merged to master but not released yet

AlexShemeshWix avatar Jun 14 '22 12:06 AlexShemeshWix

+1 need this

huynp1999 avatar Apr 26 '23 04:04 huynp1999

MultiEndpointEtcd3Client

EamonZhang avatar Apr 27 '23 01:04 EamonZhang

+1 need this!!!

litmingc avatar Nov 17 '23 07:11 litmingc