|Mark Chadwick on 18 Jun 2007 12:24:01 -0000|
I'm running a production Rails app that replicates with slony. It's been running that way for a couple years (though not always Rails) without problems. You can keep the fail-over logic out of your code by using Heartbeat. The primary DB server owns a virtual IP, and accepts all the connections. If something happens to it, the secondary takes over, and claims the IP. You might get a bad request or two in there, but it's mostly seamless.
That said, this was all set up before pgcluster was available. I've set up a smaller (not yet in production) environment with pgcluster, and it's a sight nicer. You, as advertised, talk to whichever host you'd like for reads and writes. It's very nice.
Even though it's fault-tolerant already by design, I'd probably recommend a pair of machines to run pgcluster's "Load Balancer" with heartbeat between them. That way you can keep the logic of your environment out of your code.
Otherwise, I'd just suggest catching connection refused exceptions down in ActiveRecord's guts, and retrying on another host. That's going to get messy pretty quickly, though.
On 6/18/07, Flinn Mueller <firstname.lastname@example.org> wrote:
Anyone out there using postgresql with any of the various fail over/
_______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk