Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I'm looking to add high availability to a postgresql server. I've looked into some tutorials on the web but, haven't been able to find exactly what I'm looking for.


PostgreSQL Replication and Hot Standby – In Practice

Is a great tutorial for how to set that up, BUT failover is manual.

Replication and Load Balancing with PostgreSQL and Pgpool2

Seems to be perfect only if the pgpool server was not the single point of failure.

So, my question is, if I add a HAProxy cluster, just like any pool of web servers distribute load, would I be able to have the automatic failover to the pgpool and therefore to the postgresql servers??

                    Application Servers
          ip1 -------- (floating) ip3 -------- ip2
        HAPROXY   ------- hearbeat -------- HAPROXY
        pgpool II                           pgpool II
         |    \                             /     |
         |     \                           /      |
         |      \                         /       |
        ip4<-----\-----------(to same master ip4) |
    postgres      ip5<------------------(to same slave ip5)
     Master      postgres
share|improve this question

If you have pgpool running on two servers with a "floating ip" then there's your HA!

Direct services at the floating ip/port and if one disappears, requests should begin to be served by the other?

No need for an extra HAProxy layer.

share|improve this answer

Yep, you don't need HAProxy with the newest versions pgpool-II. I'm not sure in which version it is introduced, but "watchdog" feature that is now embedded in pgpool does everything needed for automatic fialover and real HA.

Take a look at this post - it'll help for sure.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.