Mark Chadwick on 18 Jun 2007 12:24:01 -0000


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

Re: [PhillyOnRails] ha and rails


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.

-Mark

On 6/18/07, Flinn Mueller <theflinnster@gmail.com> wrote:
Anyone out there using postgresql with any of the various fail over/
high availability options (slony, pgcluster, etc) in a rails
production environment?  I'm not 100% convinced by mysql's clustering
(nmdb) since 5.1 is the first to support paging.  I've been looking
at pgcluster specifically because it seems more developed and can run
in multi-master.  Does rails even have a facility to fail over to
another db host?  Anyone care to share their experiences with a ha
rails app?
_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk

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