Recovering from a database failure

Hi, I was just wondering if there was any mechanism in rails 3 to
programmatically change the database targeted by active record? I’m
asking about this so as to be able to take advantage of database
replication to provide a fail over strategy. Beyond that it would also
make load balancing slave databases easier.

I’m making use of PostgreSQL if this changes anything.

Actually any information dealing with database failure recovery would
come in handy.

On 2012-03-26 03:11:02, Stuart J. wrote:

Actually any information dealing with database failure recovery would
come in handy.

Are you familiar with this resource? One of the first things
that show up when you search for postgresql high available:
http://www.postgresql.org/docs/8.3/static/high-availability.html

Another resource you probably want to check out out Pacemaker:
http://www.clusterlabs.org/

/Allan

Allan Wind
Life Integrity, LLC
http://lifeintegrity.com

Thanks those are both useful. I’ve seen the PostgreSQL docs page on
scaling but as far as I can tell it deals with scaling from the
databases end.

I’m more concerned with scaling rails access to the database. I’ve had a
look at Octopus GitHub - thiagopradi/octopus: Database Sharding for ActiveRecord as a potential
solution. But Octopus relies on a static configuration file to detail
all the available instances. This kind of precludes any form of failure
recovery strategy that doesn’t involve shutting down each rails instance
and changing that file.

My dream method would be to on database failure, have each rails
instance automatically pull the next databases url from somewhere and
change their targeted db on the fly.

On Mon, Mar 26, 2012 at 2:24 AM, Allan Wind
[email protected] wrote:

On 2012-03-26 03:11:02, Stuart J. wrote:

Actually any information dealing with database failure recovery would
come in handy.

Are you familiar with this resource? One of the first things
that show up when you search for postgresql high available:
http://www.postgresql.org/docs/8.3/static/high-availability.html

That’s nearly 5 years old and so misses all the cool new replication
features.

Latest production

Latest development

Another resource you probably want to check out out Pacemaker:
http://www.clusterlabs.org/

And also http://www.repmgr.org/


Simon R. http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services