Hacker News new | ask | show | jobs
by CyberDem0n 3359 days ago
Doesn't HAProxy provide such functionality? Patroni has REST API which can be used by HAProxy for a health-check.

patroni:8008/master will return http status code 200 only if the node running as elected master

patroni:8008/replica will return http status code 200 if node running as replica.

And final missing bit is a automation of generation of haproxy.cfg - it could be done with confd: https://github.com/kelseyhightower/confd

And here is an example of template file: https://github.com/zalando/patroni/blob/master/extras/confd/...

1 comments

I am not sure, will HAProxy forcibly close connections to old master in case of a failover?
on-marked-down shutdown-sessions

should do the trick