<div dir="ltr"><div><div><div><div>Hi Yugo,<br><br></div>I am using postgresql streaming replication but not in master-slave mode. The configuration I was aiming for is replication + load balancing (select-only). I understand replication is available via pgpool but not using it atm. Maybe this is the source of my troubles?<br>

<br></div>My recovery method is basically the same. I use pg_basebackup to restore node01 as standby using node02 primary. My server is running Ubuntu 14.04 so recovery.conf can be found in /var/lib/postgresql/9.3/main/. Does pgpool check if this file exist when searching for primary? If so is /var/lib/postgresql/9.3/main/ the correct location?<br>
<br></div>When select pg_is_in_recovery() (as suggested by Tatsuo Ishii and Lazaro Martinez) is run on each node, the result is always consistent: false for primary, true for standby.<br><br></div>The issue seems to be that after node01 is recovered, pgpool still doesn&#39;t know node01 belongs in the pool and as standby. It seems the node has to be re-attached. However, pg_attach_node causes a failback_command and promotes it to primary, even though node02 is currently primary. It feels like a configuration is missing somewhere.<br>
<div><div>
<br></div><div>Perhaps pcp_recovery_node is a possible solution. I will take a look.<br><br></div><div>Thanks,<br></div><div>Long<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 17, 2014 at 7:33 AM, Yugo Nagata <span dir="ltr">&lt;<a href="mailto:nagata@sraoss.co.jp" target="_blank">nagata@sraoss.co.jp</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I looked at your pgpool.conf.If you use streaming-reprication,<br>
master_slave_mode should be on and masetr_slave_sub_mode = &#39;steam&#39;.<br>
<br>
 master_slave_mode = on<br>
 master_slave_sub_mode = &#39;stream&#39;<br>
<br>
And, when you recover node01 as standby, you have to backup data<br>
from the current primary (node02) and setup recovery.conf at node01<br>
before attaching this to pgpool. Otherwize, node01 would work still<br>
as standby but as primary, since recovery.conf doesn&#39;t exist.<br>
<br>
You can use &quot;online recovery&quot; functionality of pgpool to automate<br>
backup and recovery.conf configuration. In this case, pcp_recovery_node<br>
command is used rather than pcp_attach_node.<br>
<br>
The tutorial would be helpful for you to setup streaming-replication with watchdog.<br>
<a href="http://www.pgpool.net/pgpool-web/contrib_docs/watchdog_master_slave_3.3/en.html" target="_blank">http://www.pgpool.net/pgpool-web/contrib_docs/watchdog_master_slave_3.3/en.html</a><br>
<br>
There are sample conf files and scripts in the tutorial. Alhough pgpoolAdmin<br>
is used instead of pcp command, &quot;Recovery&quot; button of pgpool is equivalent to<br>
pcp_recovery_node.<br>
<div class="HOEnZb"><div class="h5">
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Yugo Nagata &lt;<a href="mailto:nagata@sraoss.co.jp">nagata@sraoss.co.jp</a>&gt;<br>
</font></span></blockquote></div><br></div></div>