<div dir="ltr">I actually tried to replicate this scenario by issuing a select statement to pgpool and running a pg_terminate_backend command on that query in the backend cluster. This did not trigger a cluster eviction. Also, after sometime, it evicted one of the clusters when there was no pg_terminate_backend running. Can pg_terminate_backend on any session cause this or does it need to terminate the specific session that is being handled by pgpool. Either way, I could not replicate this scenario in my testing. What else could have caused this?<div><br></div><div><div>2016-11-08 21:00:19: pid 14686: LOG:  reading and processing packets</div><div>2016-11-08 21:00:19: pid 14686: DETAIL:  postmaster on DB node 0 was shutdown by administrative command</div><div>2016-11-08 21:00:19: pid 14686: LOG:  received degenerate backend request for node_id: 0 from pid [14686]</div><div>2016-11-08 21:00:19: pid 6098: LOG:  starting degeneration. shutdown host <a href="http://armada.cutpdh4v4uf7.us-east-1.redshift.amazonaws.com">armada.cutpdh4v4uf7.us-east-1.redshift.amazonaws.com</a>(5439)</div><div>2016-11-08 21:00:19: pid 6098: LOG:  Restart all children</div><div>2016-11-08 21:00:19: pid 6098: LOG:  failover: set new primary node: -1</div><div>2016-11-08 21:00:19: pid 18576: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6098: LOG:  failover: set new master node: 1</div><div>2016-11-08 21:00:19: pid 10896: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18491: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6099: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6556: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18495: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 9492: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6128: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6549: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 19025: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6103: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6127: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6554: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 19026: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 14007: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18494: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6553: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18575: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 14686: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18492: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6123: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6552: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6113: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6119: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18497: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6117: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6104: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18493: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 18496: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 12497: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6109: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6106: LOG:  child process received shutdown request signal 3</div><div>2016-11-08 21:00:19: pid 6132: LOG:  worker process received restart request</div><div>failover done. shutdown host <a href="http://armada.amazonaws.com">armada.amazonaws.com</a>(5439)2016-11-08 21:00:19: pid 6098: LOG:  failover done. shutdown host <a href="http://armada.amazonaws.com">armada.amazonaws.com</a>(5439)</div><div>2016-11-08 21:00:20: pid 6131: LOG:  restart request received in pcp child process</div><div>2016-11-08 21:00:20: pid 6098: LOG:  PCP child 6131 exits with status 0 in failover()</div><div>2016-11-08 21:00:20: pid 6098: LOG:  fork a new PCP child pid 26992 in failover()</div></div><div><br></div><div><br></div><div>For the health check error below, why is this happening only with db node 0 and not with db node 1 when both of the underlying clusters have the exact same redshift configuration?</div><div><br></div><div><div>2016-11-08 21:07:46: pid 6098: LOG:  pool_ssl: &quot;SSL_read&quot;: &quot;no SSL error reported&quot;</div><div>2016-11-08 21:07:46: pid 6098: LOG:  notice_backend_error: called from pgpool main. ignored.</div><div>2016-11-08 21:07:46: pid 6098: WARNING:  child_exit: called from invalid process. ignored.</div><div>2016-11-08 21:07:46: pid 6098: ERROR:  unable to read data from DB node 0</div><div>2016-11-08 21:07:46: pid 6098: DETAIL:  socket read failed with an error &quot;Success&quot;</div></div><div><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Thanks,<div>- Manoj</div></div></div></div>
<br><div class="gmail_quote">On Wed, Nov 9, 2016 at 1:46 AM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@sraoss.co.jp" target="_blank">ishii@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"><span class="">&gt;&gt;&gt; Whenever Pgpool-II thinks a backend is being down, there should be a<br>
&gt;&gt;&gt;log entry in the Pgpool-II log file. Please check.<br>
&gt;&gt;<br>
&gt;&gt; This is the error in the log file when this happens<br>
&gt;&gt;<br>
&gt;&gt; 2016-11-02 00:00:07: pid 9217: DETAIL:  postmaster on DB node 0 was<br>
&gt;&gt; shutdown by administrative command<br>
&gt;&gt; 2016-11-02 00:00:07: pid 9217: LOG:  received degenerate backend request<br>
&gt;&gt; for node_id: 0 from pid [9217]<br>
&gt;&gt; 2016-11-02 00:00:07: pid 9188: LOG:  starting degeneration. shutdown host<br>
&gt;&gt; <a href="http://prod1.amazonaws.com" rel="noreferrer" target="_blank">prod1.amazonaws.com</a>(5439)<br>
&gt;&gt; 2016-11-02 00:00:07: pid 9188: LOG:  Restart all children<br>
&gt;&gt;<br>
&gt;&gt; What does &quot;postmaster on DB node 0 was shutdown by administrative command&quot;.<br>
&gt;&gt; I havent sent any shutdown commands to pgpool.<br>
&gt;<br>
&gt; Someone shutdown PostgreSQL (or used pg_cancel_backend).<br>
<br>
</span>Correction. I meant pg_terminate_backend, rather than<br>
pg_cancel_backend (it just cancel current query if any and harmless<br>
for Pgpool-II).<br>
<div><div class="h5"><br>
&gt;&gt; I verify connectivity to the<br>
&gt;&gt; cluster whenever this happens and it is always fine. Why does the health<br>
&gt;&gt; check that I configured to run every 30 secs not sense that the cluster is<br>
&gt;&gt; back up again and update the pgpool_status file?<br>
&gt;<br>
&gt; See the FAQ.<br>
&gt; <a href="http://www.pgpool.net/mediawiki/index.php/FAQ#Why_does_not_Pgpool-II_automatically_recognize_a_database_comes_back_online.3F" rel="noreferrer" target="_blank">http://www.pgpool.net/<wbr>mediawiki/index.php/FAQ#Why_<wbr>does_not_Pgpool-II_<wbr>automatically_recognize_a_<wbr>database_comes_back_online.3F</a><br>
&gt;<br>
&gt;&gt; Health check details from<br>
&gt;&gt; the log are below<br>
&gt;&gt;<br>
&gt;&gt; 2016-11-01 23:59:54: pid 9188: LOG:  notice_backend_error: called from<br>
&gt;&gt; pgpool main. ignored.<br>
&gt;&gt; 2016-11-01 23:59:54: pid 9188: WARNING:  child_exit: called from invalid<br>
&gt;&gt; process. ignored.<br>
&gt;<br>
&gt; No worry for this part. There was a race condition inside Pgpool-II<br>
&gt; but was resolved.<br>
&gt;<br>
&gt;&gt; 2016-11-01 23:59:54: pid 9188: ERROR:  unable to read data from DB node 0<br>
&gt;&gt; 2016-11-01 23:59:54: pid 9188: DETAIL:  socket read failed with an error<br>
&gt;&gt; &quot;Success&quot;<br>
&gt;&gt;<br>
&gt;&gt; What dos the above log indicate?<br>
&gt;<br>
&gt; DB node 0 disconnected the socket to Pgpool-II.<br>
&gt;<br>
&gt;&gt;&gt;Yes, it randomly routes to backends. You can control the possibility<br>
&gt;&gt;&gt;of the routing.<br>
&gt;&gt;<br>
&gt;&gt; Is it possible to control routing using round robin approach or least used<br>
&gt;&gt; cluster? If so, where do I configure this?<br>
&gt;<br>
&gt; No.<br>
&gt;<br>
&gt;&gt; Thanks,<br>
&gt;&gt; - Manoj<br>
&gt;&gt;<br>
&gt;&gt; On Mon, Nov 7, 2016 at 12:08 AM, Tatsuo Ishii &lt;<a href="mailto:ishii@sraoss.co.jp">ishii@sraoss.co.jp</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; &gt; I have pgpool configured against two redshift backend clusters to do<br>
&gt;&gt;&gt; &gt; parallel writes. Seemingly at random, pgpool determines that one or both<br>
&gt;&gt;&gt; &gt; the clusters are down and stops accepting connections even when they are<br>
&gt;&gt;&gt; &gt; not down. I have health check configured every 30 seconds but that does<br>
&gt;&gt;&gt; not<br>
&gt;&gt;&gt; &gt; help as it checks heath and still determines they are down in<br>
&gt;&gt;&gt; pgpool_status<br>
&gt;&gt;&gt; &gt; file. How is health status determined and written to the file<br>
&gt;&gt;&gt; &gt; /var/log/pgpool/pgpool_status and why does pgpool think the clusters are<br>
&gt;&gt;&gt; &gt; down when they are not?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Whenever Pgpool-II thinks a backend is being down, there should be a<br>
&gt;&gt;&gt; log entry in the Pgpool-II log file. Please check.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt; I also tested read query routing and noticed they were being routed<br>
&gt;&gt;&gt; &gt; randomly to the backend clusters. Is there a specific algorithm that<br>
&gt;&gt;&gt; pgpool<br>
&gt;&gt;&gt; &gt; uses for read query routing?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Yes, it randomly routes to backends. You can control the possibility<br>
&gt;&gt;&gt; of the routing.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; My config parameters are below<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_hostname0 = &#39;cluster1&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_port0 = 5439<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_weight0 = 1<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_data_directory0 = &#39;/data1&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_flag0 = &#39;ALLOW_TO_FAILOVER&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_hostname1 = &#39;cluster2&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_port1 = 5439<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_weight1 = 1<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_data_directory1 = &#39;/data1&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; backend_flag1 = &#39;ALLOW_TO_FAILOVER&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; #-----------------------------<wbr>------------------------------<br>
&gt;&gt;&gt; &gt; -------------------<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; # HEALTH CHECK<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; #-----------------------------<wbr>------------------------------<br>
&gt;&gt;&gt; &gt; -------------------<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; health_check_period = 30<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Health check period<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Disabled (0) by default<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; health_check_timeout = 20<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Health check timeout<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # 0 means no timeout<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; health_check_user = &#39;username&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Health check user<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; health_check_password = &#39;password&#39;<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Password for health check user<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; health_check_max_retries = 10<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Maximum number of times to retry a<br>
&gt;&gt;&gt; &gt; failed health check before giving up.<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt; health_check_retry_delay = 1<br>
&gt;&gt;&gt; &gt;<br>
&gt;&gt;&gt; &gt;                                    # Amount of time to wait (in seconds)<br>
&gt;&gt;&gt; &gt; between retries.<br>
&gt;&gt;&gt;<br>
</div></div>&gt; ______________________________<wbr>_________________<br>
&gt; pgpool-general mailing list<br>
&gt; <a href="mailto:pgpool-general@pgpool.net">pgpool-general@pgpool.net</a><br>
&gt; <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>
</blockquote></div><br></div></div>