<div dir="ltr"><div><span style="font-size:12.8px">I&#39;m using online_recovery </span><b style="font-size:12.8px">only</b><span style="font-size:12.8px"> for full copy purposes - if node gets corrupted. pcp_recovery_node will execute recovery_1st_stage command which using pg_basebackup (full copy).</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">but for switchover between the nodes (<b>none</b> of the nodes gets corrupted) - just for <b>switch roles:</b></span></div><div><span style="font-size:12.8px"><b>1. shutdown the primary.</b></span></div><div><span style="font-size:12.8px"><b>2. pgpool promotes the secondary.</b></span></div><div><span style="font-size:12.8px"><b>3. perform pcp_attach_node (old primary) which calls the failback.sh:</b></span></div><div>      the failback.sh does exactly what you describe:<div>         a.<span style="font-size:12.8px">pg_start_backup()</span></div><div><span style="font-size:12.8px">         b. rsync (should be fast)</span></div><div><span style="font-size:12.8px">         c. pg_stop_</span><span style="font-size:12.8px">backup()</span></div></div><div><span style="font-size:12.8px">         d. creates recovery.conf</span></div><div><span style="font-size:12.8px">         e. start the node.</span></div><div><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">any ideas or comments??</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Thanks,</span></div><div><span style="font-size:12.8px">cohavisi</span></div><div><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 1, 2016 at 3:37 PM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org" target="_blank">ishii@postgresql.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">&gt; OK....Thanks!<br>
&gt;<br>
&gt; I&#39;m trying to implement an failover/failback on the nodes:<br>
&gt; 1. primary node gets down.<br>
&gt; 2. pgpool promotes the secondary node - make it primary.<br>
&gt; 3. by attaching the failed node (old primary) -  the failback.sh is called<br>
&gt; and recovering the failed node (using rsync - much more faster) and make it<br>
&gt; online secondary!<br>
<br>
</span>I don&#39;t know what failback.sh is doing but if it just runs rsync, it&#39;s<br>
not safe.  You should use pg_start_backup()/pg_stop_backup().<br>
<br>
BTW, if rsync is much faster for you, why don&#39;t you use it for online<br>
recovery as well?<br>
<span class=""><br>
&gt; from what you are saying...<br>
</span>&gt; just to make sure, I *can not* use the failback.sh script (which called by<br>
<span class="">&gt; pcp_attach_node) in order &quot;recover&quot; the node and make it online (as<br>
&gt; scondary).<br>
<br>
</span>Ok, but failback.sh is not supposed to do what you want.<br>
I recommend you to look into follow master command.<br>
<div class="HOEnZb"><div class="h5"><br>
Best regards,<br>
--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Thanks,<br>
&gt; cohavisi<br>
&gt;<br>
&gt; On Tue, Mar 1, 2016 at 2:15 PM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; I&#39;m not sure what you want to do (especialy I&#39;m confused by<br>
&gt;&gt; &quot;secondary&quot;: what does it mean?). Have you taken look at follow master<br>
&gt;&gt; script?<br>
&gt;&gt;<br>
&gt;&gt; Anyway...<br>
&gt;&gt;<br>
&gt;&gt; pcp_attach_node should be used for the case PostgreSQL server is<br>
&gt;&gt; online and ready to use. Not for recovering a PostgreSQL server.<br>
&gt;&gt;<br>
&gt;&gt; Best regards,<br>
&gt;&gt; --<br>
&gt;&gt; Tatsuo Ishii<br>
&gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt; Thanks for your replay...<br>
&gt;&gt; &gt; I do use online recovery in case a full recovery is needed (using<br>
&gt;&gt; &gt; pg_basebackup - via pcp_recovery_node).<br>
&gt;&gt; &gt; but I added an ability to perform a switchover between the nodes using<br>
&gt;&gt; &gt; stop/detach primary - failover occurs and reattach it as secondary (using<br>
&gt;&gt; &gt; failback script).<br>
&gt;&gt; &gt; but as the failback finished the pgpool does not attach it as secondary!!<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Can you please advice?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; cohavisi<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Tue, Mar 1, 2016 at 10:41 AM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; You should use online recovery instead of pcp_attach_node.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Best regards,<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt; Tatsuo Ishii<br>
&gt;&gt; &gt;&gt; SRA OSS, Inc. Japan<br>
&gt;&gt; &gt;&gt; English: <a href="http://www.sraoss.co.jp/index_en.php" rel="noreferrer" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;&gt; &gt; I have a Hugh problem regarding attaching a node (as secondary) to the<br>
&gt;&gt; &gt;&gt; pool<br>
&gt;&gt; &gt;&gt; &gt; after I performing pcp_attach_node.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; after failover is being completed successfully and valid primary node<br>
&gt;&gt; is<br>
&gt;&gt; &gt;&gt; &gt; active, i&#39;m performing an *pcp_attach (via sql)* to the faulty node in<br>
&gt;&gt; &gt;&gt; &gt; order to failback as secondary!<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; *select pcp_attach_node (0,&#39;10.10.61.99&#39;,1200,9898,&#39;*****&#39;,&#39;*****&#39;) *<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; during this command, a failback script is being executed and performs<br>
&gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt; following:<br>
&gt;&gt; &gt;&gt; &gt; 1. rsync between the DB nodes.<br>
&gt;&gt; &gt;&gt; &gt; 2. create recovery.conf.<br>
&gt;&gt; &gt;&gt; &gt; 3. startup the node(as secondary).<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; *the failback could take for 20 min to finish.*<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; after the failback finished *successfully* (exit status 0) and the<br>
&gt;&gt; node<br>
&gt;&gt; &gt;&gt; &gt; started as *secondary* (according to postgres) - streaming<br>
&gt;&gt; replication.<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; *the pgpool reportes the node status from 1 to 3 (instead of 2).*<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; *** when failback finished early (less then few min) the pgpool<br>
&gt;&gt; reports<br>
&gt;&gt; &gt;&gt; the<br>
&gt;&gt; &gt;&gt; &gt; node status as 2 - as aspected.*<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; please advice regarding this issue...<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; *Thanks,*<br>
&gt;&gt; &gt;&gt; &gt; *cohavisi*<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt;<br>
</div></div></blockquote></div><br></div>