Christopher Browne cbbrowne at ca.afilias.info
Fri Dec 14 13:18:13 PST 2007
"Josh Harrison" <joshques at gmail.com> writes:
> I have a question regarding slony's switchover and failover option
> The document says
> "At the time of this writing switchover to another server requires the application to reconnect to the database. So in order to avoid any complications, we simply
> shut down the web server. Users who use pg_pool for the applications database connections merely have to shut down the pool."

If I describe this issue differently (and maybe that means changing
the docs!), maybe it'll make it clearer...

Any time you do switchover from one server to another, say, from "DB1"
to "DB2", this requires that the applications that were connecting to
DB1 drop those connections, and connect to DB2, instead.

How you will accomplish this is hugely dependent on how you set your
environment up.

Options might include:

 - Stop the application, change "DB1" to "DB2" in a config file, and
   restart the application.

 - Use a DNS CNAME so that your application points to "DBSERVER;" that
   way, you initially have DNS set up so that DBSERVER is a CNAME
   pointing at DB1, and you later change it to be a CNAME pointing at
   DB2.

   You may need for your application to be restarted in order for it
   to know to reopen DB connections.

 - If you're using pg_pool, or something similar, then the
   reconfiguration involves reconfiguring pg_pool, rather than your DNS
   server.

   But for the most part, the behaviour is logically similar to the
   DNS-based example above.

> 1  So does this mean that during the switchover, the web server
> should be shut down and users will not be able to access the
> database at that time?

Ideally, yes.  Cutting off access pretty forcibly tends to be a good
idea during a switchover; that way, there aren't any lingering locks
kicking around possibly preventing the switchover from completing
quickly.

> 2. Is there any time frame for this switchover ie., how long it
> takes ? what does this depend on?

The reason for it to take > 1s is that there are processes connected
to either the former master node or the soon-to-be-master node,
holding locks on tables that the switchover process needs to modify.

> 3. Is there any other way to keep the web server up running during
> this switch over operation?

If you're using some mechanism like CNAME/pg_pool so that it's always
pointing at "something current," and the application knows enough to
re-open connections any time it finds they fail, that may "play OK."
-- 
output = ("cbbrowne" "@" "linuxfinances.info")
http://cbbrowne.com/info/wp.html
Your latest program has been judged UNTASTEFUL by the T daemon;
and automatically deleted.


More information about the Slony1-general mailing list