<div dir="ltr">They are relevant:<div>







<p class=""><span class=""><font face="monospace, monospace">[vlad@pgpool2 ~]$ ps ax | grep postgres</font></span></p><p class=""><span class=""><font face="monospace, monospace">...</font></span></p><p class=""><span class=""><font face="monospace, monospace">







</font></span></p><p class=""><font face="monospace, monospace"><span class=""><b>62230</b> ?        Ss     0:00 </span><span class="">postgres</span><span class="">: myuser mydb 192.168.241.101(39856) idle</span></font></p><p class=""><span class=""><font face="monospace, monospace">...</font></span></p><p class=""><span class=""><font face="monospace, monospace">[vlad@pgpool2 ~]$ pcp_proc_info -U postgres -w -h pgpool1 -v | grep -B7 -A1 62230</font></span></p><p class=""><span class=""><font face="monospace, monospace">Database     : mydb</font></span></p><p class=""><span class=""><font face="monospace, monospace">Username     : myuser</font></span></p><p class=""><span class=""><font face="monospace, monospace">Start time   : 2016-08-23 21:23:54</font></span></p><p class=""><span class=""><font face="monospace, monospace">Creation time: 2016-08-23 23:01:21</font></span></p><p class=""><span class=""><font face="monospace, monospace">Major        : 3</font></span></p><p class=""><span class=""><font face="monospace, monospace">Minor        : 0</font></span></p><p class=""><span class=""><font face="monospace, monospace">Counter      : 2</font></span></p><p class=""><font face="monospace, monospace"><span class="">Backend PID  : </span><span class=""><b>62230</b></span></font></p><p class=""><span class=""><font face="monospace, monospace">
















</font></span></p><p class=""><span class=""><font face="monospace, monospace">Connected    : 1</font></span></p><p class=""><span class=""><br></span></p><p class=""><span class="">From what I understand, connected stands for the backend id (which is 1 in this case).</span></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 23, 2016 at 9:35 PM, Tatsuo Ishii <span dir="ltr"><<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@sraoss.co.jp</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You can use pcp_proc_info command to check if the PostgreSQL process<br>
are relevant to Pgpool-II or not.<br>
<br>
<a href="http://www.pgpool.net/docs/latest/pgpool-en.html#pcp_proc_info" rel="noreferrer" target="_blank">http://www.pgpool.net/docs/<wbr>latest/pgpool-en.html#pcp_<wbr>proc_info</a><br>
<span class=""><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_<wbr>en.php</a><br>
Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.<wbr>jp</a><br>
<br>
</span><span class="">> Interesting thing, though, is that I see postgres processes being forked on<br>
> pgpool2 eve though in the logs I see only the queries listed above.<br>
> ...<br>
><br>
</span>> 65032 ?        Ss     0:00 *postgres*: myuser mydb 192.168.241.101(40278)<br>
> idle<br>
><br>
> 65033 ?        Ss     0:00 *postgres*: myuser mydb 192.168.241.101(40280)<br>
> idle<br>
><br>
> 65034 ?        Ss     0:00 *postgres*: myuser mydb 192.168.241.101(40282)<br>
> idle<br>
><br>
> 65035 ?        Ss     0:00 *postgres*: myuser mydb 192.168.241.101(40288)<br>
> idle<br>
><br>
> 65036 ?        Ss     0:00 *postgres*: myuser mydb 192.168.241.101(40290)<br>
<div class="HOEnZb"><div class="h5">> idle<br>
><br>
> [vlad@pgpool2 ~]$ ps ax | grep postgres | grep myuser | wc -l<br>
><br>
> 317<br>
><br>
> Any ideas why can those processes be forked? It feels like pgpool creates<br>
> slots just in case it needs to failover, but it's not documented anywhere<br>
> and that's why it looks weird.<br>
><br>
> On Tue, Aug 23, 2016 at 9:30 AM, Vlad Novikov <<a href="mailto:xou.slackware@gmail.com">xou.slackware@gmail.com</a>><br>
> wrote:<br>
><br>
>> Ok, looks like the connections I see on pgpool2 are just healthchecks and<br>
>> standard db SELECT calls:<br>
>><br>
>> SELECT 1;<br>
>><br>
>> SELECT class.relname, blocking_activity.client_addr,<br>
>> blocking_activity.query FROM  pg_catalog.pg_locks blocked JOIN<br>
>> pg_catalog.pg_stat_activity a ON a.pid=blocked.pid JOIN pg_catalog.pg_locks<br>
>> locks ON locks.locktype = blocked.locktype AND locks.DATABASE IS NOT<br>
>> DISTINCT FROM blocked.DATABASE AND locks.relation IS NOT DISTINCT FROM<br>
>> blocked.relation AND locks.page IS NOT DISTINCT FROM blocked.page AND<br>
>> locks.tuple IS NOT DISTINCT FROM blocked.tuple AND locks.virtualxid IS NOT<br>
>> DISTINCT FROM blocked.virtualxid AND locks.transactionid IS NOT DISTINCT<br>
>> FROM blocked.transactionid AND locks.classid IS NOT DISTINCT FROM<br>
>> blocked.classid AND locks.objid IS NOT DISTINCT FROM blocked.objid AND<br>
>> locks.objsubid IS NOT DISTINCT FROM blocked.objsubid AND locks.pid !=<br>
>> blocked.pid JOIN pg_catalog.pg_stat_activity blocking_activity ON<br>
>> blocking_activity.pid=locks.<wbr>pid JOIN pg_catalog.pg_class class ON<br>
>> class.oid=locks.relation WHERE NOT blocked.GRANTED;<br>
>><br>
>> I think we can consider this solved. Thank you, guys, for helping with<br>
>> this.<br>
>><br>
>> Regards,<br>
>><br>
>> Vlad<br>
>><br>
>> On Mon, Aug 22, 2016 at 3:41 PM, Tatsuo Ishii <<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>> wrote:<br>
>><br>
>>> > Hello,<br>
>>> ><br>
>>> > I attach node only when I start the failover node (PostgreSQL) after<br>
>>> > primary is up and running. E.g. I start PostgreSQL on pgpool1, then I<br>
>>> start<br>
>>> > popool-II and it detects the backend.<br>
>>><br>
>>> Probably at this point a fail over happens because PostgreSQL pgpool2<br>
>>> is not running. So far so good.<br>
>>><br>
>>> > Then, when I start pgpool2, I need to<br>
>>> > manually attach it, so pgpool-II would know that the backend is online,<br>
>>> > right?<br>
>>><br>
>>> Correct.<br>
>>><br>
>>> > Now nodes status. At this moment I see following nodes status:<br>
>>> > node_id  hostname   port   status   lb_weight  role       select_cnt<br>
>>> > 0        pgpool1    5432      2     0.500000   primary    66133198<br>
>>> > 1        pgpool2    5432      2     0.500000   standby    0<br>
>>><br>
>>> I don't know which node you executed "show pool_nodes" but as long as<br>
>>> the result of the command are same, it is ok.<br>
>>><br>
>>> So you sometimes see write queries are sent to PostgreSQL on pgpool2?<br>
>>><br>
>>> > I have a sneaky feeling that lb_weight has something to do about what is<br>
>>> > going on. However, if you take a look at the pgpool.conf attached to the<br>
>>> > initial message, you'll find the backends configured like this:<br>
>>> > backend_hostname0 = 'pgpool1'<br>
>>> > backend_port0 = 5432<br>
>>> > backend_weight0 = 1<br>
>>> > backend_data_directory0 = '/var/lib/pgsql/9.4/data'<br>
>>> > backend_flag0 = 'ALLOW_TO_FAILOVER'<br>
>>> ><br>
>>> > backend_hostname1 = 'pgpool2'<br>
>>> > backend_port1 = 5432<br>
>>> > backend_weight1 = 1<br>
>>> > backend_data_directory1 = '/var/lib/pgsql/9.4/data'<br>
>>> > backend_flag1 = 'ALLOW_TO_FAILOVER'<br>
>>> ><br>
>>> > In particular, backend_weight is set to 1 on both nodes.<br>
>>><br>
>>> Don't worry. The load balance weight is always "normalized" so that<br>
>>> the tatal weight is 1.0.<br>
>>><br>
>>> > Also, as far as I<br>
>>> > understand, this setting should not matter when load_balance_mode=off.<br>
>>><br>
>>> Correct.<br>
>>><br>
>>> > Regards,<br>
>>> > Vlad<br>
>>> ><br>
>>> ><br>
>>> > On Sat, Aug 20, 2016 at 4:37 PM, Tatsuo Ishii <<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>><br>
>>> wrote:<br>
>>> ><br>
>>> >> > Hi Lucas,<br>
>>> >> ><br>
>>> >> > I checked the log and found no failover entries. Here's how that<br>
>>> >> happens. I<br>
>>> >> > start two postgres backends (master-slave streaming replication) and<br>
>>> >> > pgpool-II instance. Then I attach both of the nodes and initially<br>
>>> all the<br>
>>> >> > clients get connected to master only.<br>
>>> >><br>
>>> >> Why do you need attach the backends? Pgpool-II automatically attach<br>
>>> >> all backends valid in pgpool.conf.<br>
>>> >><br>
>>> >> > I see that with ps ax | grep<br>
>>> >> > postgres. After some time new clients start getting connected to the<br>
>>> hot<br>
>>> >> > standby node while older clients are still connected to master.<br>
>>> Again, I<br>
>>> >> > see that with ps ax | grep postgres. In that case both master and hot<br>
>>> >> > standby have pgpool-II connected. That's what concerns me the most.<br>
>>> If<br>
>>> >> > there was a failover event, master would've been detached and there<br>
>>> would<br>
>>> >> > be no pgpool-II connections there.<br>
>>> >><br>
>>> >> Can you connect to pgool using psql then issue "show pool_nodes" when<br>
>>> >> pgpool starts to behaves like this? This should show which is the<br>
>>> >> primary node (role) and which node should be the node the query routes<br>
>>> >> to (load_balance_node).<br>
>>> >><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_<wbr>en.php</a><br>
>>> >> Japanese:<a href="http://www.sraoss.co.jp" rel="noreferrer" target="_blank">http://www.sraoss.co.<wbr>jp</a><br>
>>> >><br>
>>> >> > Vlad<br>
>>> >> ><br>
>>> >> > On Sat, Aug 20, 2016 at 1:25 AM, Lucas Luengas <<br>
>>> <a href="mailto:lucasluengas@gmail.com">lucasluengas@gmail.com</a>><br>
>>> >> > wrote:<br>
>>> >> ><br>
>>> >> >> Hello.<br>
>>> >> >><br>
>>> >> >> Have you checked pgpool log file?  Maybe a failover happened?<br>
>>> >> >><br>
>>> >> >> On Fri, Aug 19, 2016 at 10:48 PM, Vlad Novikov <<br>
>>> <a href="mailto:xou.slackware@gmail.com">xou.slackware@gmail.com</a><br>
>>> >> ><br>
>>> >> >> wrote:<br>
>>> >> >><br>
>>> >> >>> Hello,<br>
>>> >> >>><br>
>>> >> >>> I'm have setup pgpool-II with 2 backends in streaming mode (see<br>
>>> >> >>> configuration file attached). In particular, I have<br>
>>> load_balance_mode<br>
>>> >> = off<br>
>>> >> >>> to make sure that in this pool all connections will be established<br>
>>> to<br>
>>> >> >>> streaming master only. However, over some time I see pgpool-II<br>
>>> >> establishing<br>
>>> >> >>> connections to hot standby server. As a result client applications<br>
>>> >> start<br>
>>> >> >>> failing as they cannot write to the database they're connected to.<br>
>>> So<br>
>>> >> far<br>
>>> >> >>> the only solution for me is to keep the hot standby detached<br>
>>> (which is<br>
>>> >> not<br>
>>> >> >>> a good idea in terms of automated failover).<br>
>>> >> >>> Pgpool-II starts behaving like this at about 100 clients connected.<br>
>>> >> >>> PostgreSQL max_connections is set to 900 and with hot standby<br>
>>> detached<br>
>>> >> >>> there are no connection issues reported (all clients can connect<br>
>>> to the<br>
>>> >> >>> backend with no issues).<br>
>>> >> >>> I use pgpool-II and PostgreSQL provided by PostgreSQL official<br>
>>> >> repository.<br>
>>> >> >>> PostgreSQL 9.4.9<br>
>>> >> >>> pgpool-II 3.5.3<br>
>>> >> >>> OS: CentOS 7.2<br>
>>> >> >>><br>
>>> >> >>> Is there anything I need to change in the configuration file to<br>
>>> make<br>
>>> >> all<br>
>>> >> >>> clients connect to master only when both backends are attached?<br>
>>> From<br>
>>> >> what I<br>
>>> >> >>> understand that is expected with load_balance_mode = off.<br>
>>> >> >>><br>
>>> >> >>> Regards,<br>
>>> >> >>> Vlad<br>
>>> >> >>><br>
>>> >> >>> ______________________________<wbr>_________________<br>
>>> >> >>> pgpool-general mailing list<br>
>>> >> >>> <a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
>>> >> >>> <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/<wbr>listinfo/pgpool-general</a><br>
>>> >> >>><br>
>>> >> >>><br>
>>> >> >><br>
>>> >><br>
>>><br>
>><br>
>><br>
</div></div></blockquote></div><br></div>