Skip to main content
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 `date +%Y%m%d%H%M%S%s%N`

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()
{'Status': 'alive', 'DelegateCur': 4, 'Addr': '127.0.0.1', 'Tags': {'startedat': 999999999999999999999999, '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'}
```

## Serf run example

```
/usr/local/bin/serf agent -config-dir=/etc/serf/ -tag startedat=`date +%Y%m%d%H%M%S%s%N`
```

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

Release files for serf_membership 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for serf_membership 1.2
File Size Uploaded
serf_membership-1.2.tar.gz 2.7 kB Details

Release files / serf_membership-1.2.tar.gz

Download URL serf_membership-1.2.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
df0b888bb52827b9e58d792ba7cc3d04f69fa1e6f0f056afd8c3d885a562c331
BLAKE2b-256 checksum
How to use checksums
a2e1de5bc8b6428cad3db874de2eecb6f9265ad23698fe1e2b5a47b471c37df8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.2 This release

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page