Take the 2-minute tour ×

I have a local application running on a LAN. Sometimes a database gets shutdown. In such a scenario how can I keep the application working? Can I have two concurrent databases so that one picks up the work when the other becomes unavailable?


migration rejected from stackoverflow.com Jun 12 '13 at 11:54


closed as not a real question by Mark Storey-Smith, Mat, Paul White, RolandoMySQLDBA, dezso Jun 12 '13 at 11:54


1 Answer 1

First, "sometimes one of them gets shut down" isn't a good approach. You need controlled infrastructure or you won't get anything reliable.

You might want to look in to PgPool-II's statement-based replication, but it's got a lot of limitations.

A better solution for most applications is to use master/standby fail-over with heartbeat and HAProxy or similar. See the manual for more info. This wiki page might also be interesting, though it's more of a link catalogue.

repmgr can be a useful part of a HA setup, and the new version is being enhanced with some more HA-specific features.

Finally, the team I'm a minor part of is working on bi-directional logical replication for PostgreSQL, which would provide multi-master replication (not multi-master "clustering" since there's no global transaction manager, global lock manager, etc).

Netflix would disagree with you: thenextweb.com/insider/2013/03/03/… –  Neil McGuigan Jun 11 '13 at 17:33
@NeilMcGuigan Oh, I completely agree, and that's a good point. We're just talking about very different scales and experience levels here - I don't think this Mridul person is quite ready for chaosmonkey if they're asking questions like this one. –  Craig Ringer Jun 11 '13 at 23:24