I'd like to use HAProxy to implement a simple proxy that can perform
failover for a pair of PostgreSQL configured as master/slave with
PostgreSQL 9.0 streaming replication to replicate the master to the
slave. Only the master is active for client connections, unless the
master fails, then the clients should connect to the slave while an
administrator recovers the master.
Thus, I need a setup in HAProxy, where all traffic goes to the master,
until the master fails, then all traffic goes to the slave.
I've studied the MySQL balancing setup described here:
http://www.alexwilliams.ca/blog/2009/08/10/using-haproxy-for-mysql-failover-and-redundancy/
With this as a basis, I could create a daemon on the HAProxy machine
that tests the master and reports on the health of the master via
HTTP. The HTTP health check is used with an ACL in a frontend. If the
master is up, the master backend is used. If it is down the slave
backend is used.
Or else, I could test for the health of the master, and when it fails
I can kill, reconfigure and restart HAProxy. It might be easier.
Sound like a good use of HAProxy? Are their any known issues with
HAProxy and PostgreSQL?
--
Alan Gutierrez