3 releases
0.1.2 | Mar 8, 2023 |
---|---|
0.1.1 | Mar 8, 2023 |
0.1.0 | Nov 24, 2022 |
#9 in #hot
25KB
567 lines
failover
etcd-based consensus for [hot spare
Algorithm
Lease part
- Client asks etcd for an initial lease for N seconds and receives a lease id.
- The lease is renewed every N/2 seconds.
- If connection is lost then client uses the same lease id to renew the lease.
NOTE: It's ½64 chance that the lease ID is reused.
Election part
- Client starts a campaign with a random timeout. If election expires then there is another leader. Client asks etcd for the leader lease id and waits until it dies.
- Client polls etcd every lease lifetime seconds. If etcd returns -1 then leader is dead, goto 1.
Dependencies
~14–27MB
~485K SLoC