Flinn Mueller on 18 Jun 2007 13:28:04 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] ha and rails

Thanks Mark, this is what I was looking for.

On Jun 18, 2007, at 8:23 AM, Mark Chadwick wrote:

Hey Flinn,

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.


_______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk