Hacker News new | ask | show | jobs
by CyberDem0n 3354 days ago
Patroni has REST API providing a health-checks for load-balancers. patroni:8008/replica will respond with http status code 200 only if node is running as replica.

In the HAProxy config file you just need to list all Patroni nodes, specify a health-check and it will do a load-balancing for you.

The same approach works for example with AWS ELB.

1 comments

But writes need to be directed to the master, right? Or Patroni is smart enough to do it by itself?
Correct. Writes need to be directed to master. May be not only writes but some reads as well. Only application can know which statement can be executed on replicas and which must be executed on master.