<div dir="ltr">Hi,<div><br></div><div>   i have configured a stream replication pgpool and using watchdog for failovers.</div><div>I often see the below messages in the log:</div><div><br></div><div>2019-05-27T10:34:51+00:00  process[6714]: [15-1] 2019-05-27 10:34:51: pid 6714: LOG:  Replication of node:1 is behind 671088848 bytes from the primary server (node:0)<br>2019-05-27T10:34:51+00:00  process[6714]: [15-2] 2019-05-27 10:34:51: pid 6714: CONTEXT:  while checking replication time lag<br>2019-05-27T10:34:51+00:00  process[6714]: [16-1] 2019-05-27 10:34:51: pid 6714: LOG:  Replication of node:2 is behind 1124073680 bytes from the primary server (node:0)<br>2019-05-27T10:34:51+00:00  process[6714]: [16-2] 2019-05-27 10:34:51: pid 6714: CONTEXT:  while checking replication time lag<br>2019-05-27T10:35:01+00:00  process[6714]: [17-1] 2019-05-27 10:35:01: pid 6714: LOG:  Replication of node:1 is behind 671088848 bytes from the primary server (node:0)<br>2019-05-27T10:35:01+00:00  process[6714]: [17-2] 2019-05-27 10:35:01: pid 6714: CONTEXT:  while checking replication time lag<br>2019-05-27T10:35:01+00:00  process[6714]: [18-1] 2019-05-27 10:35:01: pid 6714: LOG:  Replication of node:2 is behind 1124073680 bytes from the primary server (node:0)<br>2019-05-27T10:35:01+00:00  process[6714]: [18-2] 2019-05-27 10:35:01: pid 6714: CONTEXT:  while checking replication time lag<br></div><div><br></div><div>Questions :</div><div><br></div><div>1. Does the above statement mean when failover happens and node  1 / 2 is choosen as the primary postgres master, since there is some replication lag, some data would be lost?</div><div><br></div><div>2. Please let me know how to over come this ?</div><div><br></div><div>Thanks And Regards,</div><div><br></div><div>   Lakshmi Y M</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 24, 2019 at 12:18 PM Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">&gt;&gt; Ok. So the reason behind the ask was if pgpool is not going to retry the<br>
&gt; promote on other nodes, I was thinking i can just trigger a force promote<br>
&gt; there by failover and follow master will be run by pgpool itself and i dont<br>
&gt; have to do a failover by myself and run pcp_recovery on all the nodes<br>
<br>
Probably you misunderstand what Pgpool-II is expected to do. Pgpool-II<br>
does nothing with PostgreSQL promotion. It&#39;s completely the script<br>
writer&#39;s responsibility to handle the promotion retrying if<br>
neccessary.<br>
<br>
&gt; Regarding 5. It&#39;s normal. Don&#39;t worry.<br>
&gt; <br>
&gt; When a standby PostgreSQL node is added, existing connections to<br>
&gt; Pgpool-II are kept (thus do not use the new standby for load<br>
&gt; balacing). After the session ends, Pgpool-II child process checks<br>
&gt; whether the failback has happend. If happend, exits itself so that new<br>
&gt; process is spwan to reflect the fact that new standby node has been<br>
&gt; added (thus it can use the new standby for load balancing).<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt;&gt; Thanks. Per my understanding, So restart happens only when a new standby<br>
&gt; is added is it. Because i see this frequent restarts happening even when<br>
&gt; there is no fallback.<br>
<br>
The failbacke event detection could happen long after the failback<br>
happend if a user keeps on connection to Pgpool-II.<br>
<br>
&gt; Also could you please share some light on when the failback_command gets<br>
&gt; executed? I have never seen the command being called.<br>
<br>
It is called when pcp_attach_node or pcp_recovery_node get<br>
executed. Also it could happen when follow_master_command gets<br>
executed if it executes pcp_recovery_node inside the command.<br>
<br>
&gt; <br>
&gt; Thanks And Regards,<br>
&gt; <br>
&gt;    Lakshmi Y M<br>
&gt; <br>
&gt; On Tue, May 21, 2019 at 8:02 PM Lakshmi Raghavendra &lt;<a href="mailto:lakshmiym108@gmail.com" target="_blank">lakshmiym108@gmail.com</a>&gt;<br>
&gt; wrote:<br>
&gt; <br>
&gt;&gt; Hi,<br>
&gt;&gt;<br>
&gt;&gt;    I had couple of queries as below :<br>
&gt;&gt;<br>
&gt;&gt; On Thu, May 16, 2019 at 2:17 AM Muhammad Usama &lt;<a href="mailto:m.usama@gmail.com" target="_blank">m.usama@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Fri, May 10, 2019 at 6:38 PM Lakshmi Raghavendra &lt;<br>
&gt;&gt;&gt; <a href="mailto:lakshmiym108@gmail.com" target="_blank">lakshmiym108@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt; I am trying pgpool for automatic faliover on my postgresql cluster using<br>
&gt;&gt;&gt;&gt; the watchdog feature<br>
&gt;&gt;&gt;&gt; Wanted to know a couple of things<br>
&gt;&gt;&gt;&gt; 1. Are there any hooks when pgpool re-elects next pgpool master ? wanted<br>
&gt;&gt;&gt;&gt; to run some customization during this time<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Pgpool executes the user provided commands at the time of acquiring and<br>
&gt;&gt;&gt; releasing of virtual IP by master pgpool node. You can<br>
&gt;&gt;&gt; configure wd_escalation_command and wd_de_escalation_command configuration<br>
&gt;&gt;&gt; parameters to provide the custom command or script.<br>
&gt;&gt;&gt; Pgpool which executed wd_escalation_command command when it gets elected<br>
&gt;&gt;&gt; as a master and performs the escalation<br>
&gt;&gt;&gt; and similarly when the it node will resign as a master the wd_de_escalation_command<br>
&gt;&gt;&gt; command gets executed,<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 1. I tried using the  above wd_escalation_command and wd_de_escalation_command.<br>
&gt;&gt; I have a 3 node cluster, Observed that the escalation command will be<br>
&gt;&gt; triggered if there are at least 2 nodes alive in the pgpool cluster.<br>
&gt;&gt; If there is only master pgpool alive with no slave nodes, the command is<br>
&gt;&gt; never initiated. Is this behavior expected ?<br>
&gt;&gt;<br>
&gt;&gt; 2. Wanted to understand the significance of VIP, Is there any issue caused<br>
&gt;&gt; if I dont use the VIP in a 3-node pgpool cluster.<br>
&gt;&gt;<br>
&gt;&gt; Please let me know.<br>
&gt;&gt;<br>
&gt;&gt; Thanks And Regards,<br>
&gt;&gt;<br>
&gt;&gt;    Lakshmi Y M<br>
&gt;&gt;<br>
&gt;&gt; On Thu, May 16, 2019 at 2:17 AM Muhammad Usama &lt;<a href="mailto:m.usama@gmail.com" target="_blank">m.usama@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Fri, May 10, 2019 at 6:38 PM Lakshmi Raghavendra &lt;<br>
&gt;&gt;&gt; <a href="mailto:lakshmiym108@gmail.com" target="_blank">lakshmiym108@gmail.com</a>&gt; wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;&gt; I am trying pgpool for automatic faliover on my postgresql cluster using<br>
&gt;&gt;&gt;&gt; the watchdog feature<br>
&gt;&gt;&gt;&gt; Wanted to know a couple of things<br>
&gt;&gt;&gt;&gt; 1. Are there any hooks when pgpool re-elects next pgpool master ? wanted<br>
&gt;&gt;&gt;&gt; to run some customization during this time<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Pgpool executes the user provided commands at the time of acquiring and<br>
&gt;&gt;&gt; releasing of virtual IP by master pgpool node. You can<br>
&gt;&gt;&gt; configure wd_escalation_command and wd_de_escalation_command configuration<br>
&gt;&gt;&gt; parameters to provide the custom command or script.<br>
&gt;&gt;&gt; Pgpool which executed wd_escalation_command command when it gets elected<br>
&gt;&gt;&gt; as a master and performs the escalation<br>
&gt;&gt;&gt; and similarly when the it node will resign as a master the wd_de_escalation_command<br>
&gt;&gt;&gt; command gets executed,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; <a href="http://www.pgpool.net/docs/latest/en/html/runtime-watchdog-config.html#CONFIG-WATCHDOG-ESCALATION-DE-ESCALATION" rel="noreferrer" target="_blank">http://www.pgpool.net/docs/latest/en/html/runtime-watchdog-config.html#CONFIG-WATCHDOG-ESCALATION-DE-ESCALATION</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; 2. Will the VIP get assigned ony if there are more than 1 node present<br>
&gt;&gt;&gt;&gt; in the pgpool cluster? I had 3 nodes where i had pgpool running. When the<br>
&gt;&gt;&gt;&gt; 1st and 2nd node&#39;s pgpool was shut i was expecting the 3rd node to acquire<br>
&gt;&gt;&gt;&gt; the VIP but it didn&#39;t happen. And if my understanding was right i was<br>
&gt;&gt;&gt;&gt; thinking of using the VIP in my database connection string (Since it will<br>
&gt;&gt;&gt;&gt; always be with pgpool master who can connect to my postgresql primary). Now<br>
&gt;&gt;&gt;&gt; if the 3rd node is not acquiring the VIP, i could not use it my connection<br>
&gt;&gt;&gt;&gt; string. Correct me if my understanding is wrong<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; master pgpool only acquires the VIP when the quorum exists ( minimum 50%<br>
&gt;&gt;&gt; of nodes are reachable). This is done by Pgpool to guard against the<br>
&gt;&gt;&gt; split-brain syndrome, which could happen<br>
&gt;&gt;&gt; otherwise in case of network partitioning. So if you have 3 Pgpool nodes<br>
&gt;&gt;&gt; configured than the VIP will only get assigned on master node when at-least<br>
&gt;&gt;&gt; 2 Pgpool nodes are alive and reachable.<br>
&gt;&gt;&gt; but in case of 2 node configuration, only 1 node is required to ensure<br>
&gt;&gt;&gt; the quorum and in that case even if the single node is alive, it will get<br>
&gt;&gt;&gt; the VIP<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt; Best Regards<br>
&gt;&gt;&gt; Muhammad Usama<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Thanks in advance<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;    Lakshmi Y M<br>
&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt; pgpool-general mailing list<br>
&gt;&gt;&gt;&gt; <a href="mailto:pgpool-general@pgpool.net" target="_blank">pgpool-general@pgpool.net</a><br>
&gt;&gt;&gt;&gt; <a href="http://www.pgpool.net/mailman/listinfo/pgpool-general" rel="noreferrer" target="_blank">http://www.pgpool.net/mailman/listinfo/pgpool-general</a><br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
</blockquote></div>