Reading — step 1 of 5
Read
~1 min readMembership Tracking
Membership Tracking
Each node maintains a list of cluster members + their state. Gossip exchanges include this list.
member_list = {
"node1": {"address": "10.0.0.1", "state": "alive", "version": 5},
"node2": {"address": "10.0.0.2", "state": "alive", "version": 4},
"node3": {"address": "10.0.0.3", "state": "suspect", "version": 7},
}
When node A meets node B:
- Both share their member lists.
- Take the higher-version entry per node.
- Apply state transitions (alive → suspect → dead → leave).
States:
- alive: confirmed reachable recently.
- suspect: probe failed; not yet confirmed dead. Try to verify.
- dead: confirmed unreachable. Eventually removed.
- leaving: clean shutdown; replicate data before removal.
The version number ensures eventual convergence — older state is overridden by newer.
Initial bootstrap: a new node knows about ONE seed node. After joining, gossip teaches it about everyone else.
Hashicorp's Serf and HashiCorp Memberlist library implement this exactly. Used in Consul, Nomad.
Discussion
Ask a question, share an insight, or help someone who’s stuck.
Sign in to post a comment or reply.
Loading…