Guillaume Lelarge guillaume at lelarge.info
Sun Mar 21 09:15:00 PDT 2010
Le 21/03/2010 15:37, Philippe Clérié a écrit :
> I am trying to recover from a catastrophe and I am about to do something new 
> and I need some reassurance that it's the correct procedure.
> 
> I have a Slony replication set with two nodes in a master/slave 
> configuration, Postgresql 8.1, Slony 1.2.1 on Debian Etch. Node1 (master) was 
> taken out of commission (think a rm -rf * type error). I've recovered from a 
> previous backup that's about 3 weeks out of date, but Node2 is up to date. I 
> want Node2 to update Node1 and then I want to go back to normal.
> 
> If I understood correctly, according to the docs, the MOVE SET command is 
> the appropriate saviour. So I want to execute the following script on Node1:
> 
> cluster name = mycluster;
> node 1 admin conninfo='host=xxxxxxx';
> node 2 admin conninfo='host=yyyyyyy';
> execute script (
>    lock set (id = 1, origin = 1);
>    wait for event (origin = 1, confirmed = 2); 
>    move set (id = 1, old origin = 1, new origin = 2);
>    wait for event (origin = 1, confirmed = 2);  
> );
> 
> Taken right out of the book.
> 

Nope, if Node 1 is unavailable, you should do a failover (and not a
switchover). See failover slonik command
(http://www.slony.info/documentation/stmtfailover.html).

> I'll a reasonable amount of time (an hour should suffice), then again on Node1 
> I would execute the same script but reversing the origins:
> 
> cluster name = mycluster;
> node 1 admin conninfo='host=xxxxxxx';
> node 2 admin conninfo='host=yyyyyyy';
> execute script (
>    lock set (id = 1, origin = 2);
>    wait for event (origin = 2, confirmed = 1); 
>    move set (id = 1, old origin = 2, new origin = 1);
>    wait for event (origin = 2, confirmed = 1);  
> );
> 

This one is good. But you need to wait until they are synchronized.


-- 
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com


More information about the Slony1-general mailing list