kragniz / kragniz/python-etcd3

Why not support multi-hosts in etcd v3 client

Open
#1,258 13 comments 5 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
450
Forks
194
PR merge metrics
No merged PRs in 30d

Description

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.
```

Contributor guide

Open the contributing guide

Research direction

Start with the Etcd3Client.__init__ signature and _url construction shown in the issue, then compare how the v2 Client accepts a tuple of hosts. Define how multiple endpoints should be selected for high availability and verify that the client can connect through them; the payload names no tests or additional files.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.