Monday, January 10, 2022

PostgreSQL Patroni HAProxy ViP

High Availability and Automatic Failover in PostgreSQL on Kubernetes, On-premise and Cloud

https://www.youtube.com/watch?v=97rwCskemXo&list=PLWhC0zeznqknTPmcSrKmnV75Zr3QLfq7e&index=28


HAProxy can be configured to check via Patroni api who is the new master after a switchover : 
below picture is from above video at minute 26:23




Same ideea of a Load Balancer who uses health checks in order to find the master ==>> 

Design A Highly Available PostgreSQL Cluster With Patroni In GCP — Part 1 : 

<<
Do we need HA Proxy:
To use Patroni, we need at least 3 nodes. In case of failover, we need some Virtual(or floating) IP address to make the application continue to access the database. To reduce this dependency, the HA proxy will always talk to the master node. Here is how HA proxy knows who is the master. In HA proxy, we need to give health check port. 8008 is the default Patroni rest API port. HA proxy will send a GET Request to all the nodes in the cluster in 8008 port. Only the Master node will give 200 OK status. Other nodes will return 503 Server Unavailable.
>>

Alternative to HAProxy is  ViP-Manager : 
https://github.com/cybertec-postgresql/vip-manager

No comments:

Post a Comment