This is very simple script for election a leader (primary) from all members tagged with specific role.
Project description
Serf Membership
=======
This is very simple script for election a leader (primary) from all members tagged with specific role.
# How can i use it?
If you want to use this you should add 2 tags to every `serf agent`:
1. role
2. startedat // unixtimestamp
Based on these 2 tags `serf_membership` select single master from `role` group.
## Usage Example
```python
from serf_membership.client import SerfMembership
members = SerfMembership(role="web")
members.primary()
>>> members.primary()
{'Status': 'alive', 'DelegateCur': 4, 'Addr': '127.0.0.1', 'Tags': {'startedat': 999999999999999, 'role': 'web', 'dc': 'dc1'}, 'ProtocolMax': 3, 'DelegateMin': 2, 'ProtocolMin': 1, 'ProtocolCur': 2, 'Port': 7946, 'DelegateMax': 4, 'Name': 'os3-2.devnodes.eu-bg-sof.startappcloud.com'}
```
# Installation
from source
# git clone git@github.com:mignev/serf-membership.git
# cd serf-membership
# python setup.py install
with pip
# pip install serf_membership
#Copyright
Copyright (c) 2016 Marian Ignev. See LICENSE for further details.
=======
This is very simple script for election a leader (primary) from all members tagged with specific role.
# How can i use it?
If you want to use this you should add 2 tags to every `serf agent`:
1. role
2. startedat // unixtimestamp
Based on these 2 tags `serf_membership` select single master from `role` group.
## Usage Example
```python
from serf_membership.client import SerfMembership
members = SerfMembership(role="web")
members.primary()
>>> members.primary()
{'Status': 'alive', 'DelegateCur': 4, 'Addr': '127.0.0.1', 'Tags': {'startedat': 999999999999999, 'role': 'web', 'dc': 'dc1'}, 'ProtocolMax': 3, 'DelegateMin': 2, 'ProtocolMin': 1, 'ProtocolCur': 2, 'Port': 7946, 'DelegateMax': 4, 'Name': 'os3-2.devnodes.eu-bg-sof.startappcloud.com'}
```
# Installation
from source
# git clone git@github.com:mignev/serf-membership.git
# cd serf-membership
# python setup.py install
with pip
# pip install serf_membership
#Copyright
Copyright (c) 2016 Marian Ignev. See LICENSE for further details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
serf_membership-1.1.tar.gz
(2.6 kB
view details)
File details
Details for the file serf_membership-1.1.tar.gz
.
File metadata
- Download URL: serf_membership-1.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3330213814b88ec4b365195683969cd3fc9d8561d67e5840b8e0fc320004af2b |
|
MD5 | 33179ce3b46864fb7ec58ee81bc1fe6a |
|
BLAKE2b-256 | ad67adb49a877aa436268e3436421d5a40eb8e0e50fa51e60d1de47124a2bea7 |