all,<br>i got the failover to work.. listing the steps which might be useful for other beginners like me<br><br>node1 = master, node2=slave<br><br>node1 goes down (crash or power failure). while node1 is being recovered, if your apps have to continue writing to DB, only way i found is that we have to do the failover<br>
<br>on node 2, run the following slonik commands<br> 1) <font color="#0000ff" face="Arial" size="2">failover (id = 1, backup node =
2); (this works only if you subscribed your set originally with forward=yes)<br> 2) ensure DB can be written into (not readonly anymore)<br> 3) drop node (id = 1, event node = 2);<br>on node 1, run the following commands once it comes back in service<br>
1) dropdb <dbname><br> 2) createdb -O <dbuser> <dbname><br> 3) psql -U user -d DB < backup.sql <br> //Note : this backup.sql should not have slony tables, so its backup taken before slony was setup using pg_dump -c -s -U <user> <db> > backup.sql<br>
4) Run slonik commands to store node (1) and store path </font><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2"><br> cluster name = clus_name;</font></span>
<div><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">
node 1 admin conninfo = 'dbname=yourdb host=yournode1host user=dbuser
password=pass';<br> node 2 admin conninfo = 'dbname=</font></span><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">yourdb </font></span><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">host=</font></span><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">yournode2host </font></span><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">user=dbuser password=</font></span><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">pass</font></span><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">';</font></span></div>
<div><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">
store node (id = 1, comment = 'Node 1 slave', event node=2);<br> store path
(server = 1, client = 2,<br> conninfo = 'dbname=yourdb host=node1host
user=repusr password=pass');</font></span></div>
<div><span class="364075001-17022011"><font color="#0000ff" face="Arial" size="2">
store path (server = 2, client = 1,<br> conninfo = 'dbname=yourdb
host=node2host user=dbuser password=pass');<br> 5)Start slony daemon on node 1<br> 6) subscribe to your sets<br> subscribe set (id = 1, provider = 2, receiver = 1, forward = yes);<br> Note above, i am showing the provider is node 2 and receiver is node 1 (opposite of my initial subscribe)<br>
7) your replication should be working..<br><br></font></span></div><br><div class="gmail_quote">On Tue, Feb 15, 2011 at 9:52 PM, Tech Madhu <span dir="ltr"><<a href="mailto:technimadhu@gmail.com">technimadhu@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Thanks for your reply.<br><br>if the orig master is down say due to some hardware issue (for few hours/days say), we have to get the system on the slave up (we accept the loss of some N txn)<br>
<br>In this case, Is the following pseudcode correct. Assuming before crash of master, my master was node:1 and slave node:2<br>
On the slave (node 2), <br> a) i run failover command (failover (id=1, backup node = 2)<br> b) Run drop node command of node (1)<br> When the orig master is ready to be brought back in service can i re-use the node (1) for it?<br>
if so , is it enough to run just the following 2 commands on the original master<br> store node (id = 1, event node = 2);<br> store path (server=2, client=1, conninfo='connection info to node2')<div>
<div></div><div class="h5"><br>
<br><div class="gmail_quote">On Tue, Feb 15, 2011 at 2:52 PM, Jan Wieck <span dir="ltr"><<a href="mailto:JanWieck@yahoo.com" target="_blank">JanWieck@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>On 2/15/2011 2:44 PM, Jan Wieck wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
This is NOT possible given the Slony-I design.<br>
<br>
Slony-I is an asynchronous replication system. That means that changes<br>
to the origin are replicated some time AFTER they have been committed.<br>
That means that if the origin goes down unexpectedly, you have no chance<br>
of knowing what changes did not propagate to the replica before it crashed.<br>
<br>
The only way to solve this situation is to actually do a hard FAILOVER,<br>
abandoning the old origin and rebuilding it from scratch.<br>
<br>
To illustrate, think about a simple foreign key constraint, <a href="http://t2.fk" target="_blank">t2.fk</a><br>
references <a href="http://t1.pk" target="_blank">t1.pk</a>. There currently are no rows in t2 referencing a<br>
certain <a href="http://t1.pk" target="_blank">t1.pk</a>, so node:1 will allow to DELETE it. Node:1 crashes before<br>
the DELETE can propagate to node:2. You failover to node:2 and since it<br>
still has the t1 row, it will happily allow you to INSERT references to<br>
it into t1. Now you bring back node:1 and ... how exactly do you get the<br>
</blockquote>
<br></div>
into t2, of course.<div><div></div><div><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
two to agree what is right? Will you forcefully remove the rows, node:2<br>
inserted into t2 or will you recreate the t1 row in node:1 so that the<br>
INSERT's can propagate from node:2 to node:1?<br>
<br>
<br>
Jan<br>
<br>
</blockquote>
<br>
<br>
-- <br>
Anyone who trades liberty for security deserves neither<br>
liberty nor security. -- Benjamin Franklin<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>