Slide 9
Slide 9 text
HA Implementation
As PostgreSQL cannot talk to Kubernetes directly, So Patroni
manage PostgreSQL.
● Patroni run alongside PostgreSQL & keeps cluster state in
distributed & strongly consistent key value store like etcd.
● A leader node name is set as a value of the leader key that
expires at predefined TTL
● The leader node update leader key more often than
expiration TTL, preventing expiration.
● A non-leader node is not allowed to update the leader key
with its name.
● Each instance watches the leader key.
● Once the leader key expires, each remaining instance
decides if it is “healthy enough” * to become leader.
● The first “healthy”* instance that creates leader key with its
name, becomes leader.
★ Member is never healthy if old master is still running.
★ Member is never healthy if its WAL is behind some other
member or its too far behind the last known master position.