Backend is not destination of this message, pgpool host is, and we don&#39;t want it to ever get it. With command I&#39;ve sent you rule will be created for any source and destination.<br><br>Regards,<br>Stevo.<br><br><div class="gmail_quote">
On Wed, Jan 11, 2012 at 10:38 AM, Tatsuo Ishii <span dir="ltr">&lt;<a href="mailto:ishii@postgresql.org">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">
I did following:<br>
<br>
Do following on the host where pgpool is running on:<br>
<br>
# iptables -A FORWARD -j REJECT --reject-with icmp-port-unreachable -d 133.137.177.124<br>
(133.137.177.124 is the host where backend is running on)<br>
<br>
Pull network cable from backend0 host network interface. Pgpool<br>
detected the host being down as expected. Am I missing something?<br>
<div class="HOEnZb"><div class="h5">--<br>
Tatsuo Ishii<br>
SRA OSS, Inc. Japan<br>
English: <a href="http://www.sraoss.co.jp/index_en.php" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
<br>
&gt; Hello Tatsuo,<br>
&gt;<br>
&gt; With backend0 on one host just configure following rule on other host where<br>
&gt; pgpool is:<br>
&gt;<br>
&gt; iptables -A FORWARD -j REJECT --reject-with icmp-port-unreachable<br>
&gt;<br>
&gt; and then have pgpool startup with health checking and retrying configured,<br>
&gt; and then pull network cable from backend0 host network interface.<br>
&gt;<br>
&gt; Regards,<br>
&gt; Stevo.<br>
&gt;<br>
&gt; On Wed, Jan 11, 2012 at 6:27 AM, Tatsuo Ishii &lt;<a href="mailto:ishii@postgresql.org">ishii@postgresql.org</a>&gt; wrote:<br>
&gt;<br>
&gt;&gt; I want to try to test the situation you descrived:<br>
&gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; When system is configured for security reasons not to return<br>
&gt;&gt; destination<br>
&gt;&gt; &gt;&gt; &gt; host unreachable messages, even though health_check_timeout is<br>
&gt;&gt;<br>
&gt;&gt; But I don&#39;t know how to do it. I pulled out the network cable and<br>
&gt;&gt; pgpool detected it as expected. Also I configured the server which<br>
&gt;&gt; PostgreSQL is running on to disable the 5432 port. In this case<br>
&gt;&gt; connect(2) returned EHOSTUNREACH (No route to host) so pgpool detected<br>
&gt;&gt; the error as expected.<br>
&gt;&gt;<br>
&gt;&gt; Could you please instruct me?<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" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt;<br>
&gt;&gt; &gt; Hello Tatsuo,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thank you for replying!<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I&#39;m not sure what exactly is blocking, just by pgpool code analysis I<br>
&gt;&gt; &gt; suspect it is the part where a connection is made to the db and it<br>
&gt;&gt; doesn&#39;t<br>
&gt;&gt; &gt; seem to get interrupted by alarm. Tested thoroughly health check<br>
&gt;&gt; behaviour,<br>
&gt;&gt; &gt; it works really well when host/ip is there and just backend/postgres is<br>
&gt;&gt; &gt; down, but not when backend host/ip is down. I could see in log that<br>
&gt;&gt; initial<br>
&gt;&gt; &gt; health check and each retry got delayed when host/ip is not reachable,<br>
&gt;&gt; &gt; while when just backend is not listening (is down) on the reachable<br>
&gt;&gt; host/ip<br>
&gt;&gt; &gt; then initial health check and all retries are exact to the settings in<br>
&gt;&gt; &gt; pgpool.conf.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; PGCONNECT_TIMEOUT is listed as one of the libpq environment variables in<br>
&gt;&gt; &gt; the docs (see<br>
&gt;&gt; <a href="http://www.postgresql.org/docs/9.1/static/libpq-envars.html" target="_blank">http://www.postgresql.org/docs/9.1/static/libpq-envars.html</a> )<br>
&gt;&gt; &gt; There is equivalent parameter in libpq PGconnectdbParams ( see<br>
&gt;&gt; &gt;<br>
&gt;&gt; <a href="http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT" target="_blank">http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT</a><br>

&gt;&gt; )<br>
&gt;&gt; &gt; At the beginning of that same page there are some important infos on<br>
&gt;&gt; using<br>
&gt;&gt; &gt; these functions.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; psql respects PGCONNECT_TIMEOUT.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Regards,<br>
&gt;&gt; &gt; Stevo.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Wed, Jan 11, 2012 at 12:13 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; &gt; Hello pgpool community,<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; When system is configured for security reasons not to return<br>
&gt;&gt; destination<br>
&gt;&gt; &gt;&gt; &gt; host unreachable messages, even though health_check_timeout is<br>
&gt;&gt; &gt;&gt; configured,<br>
&gt;&gt; &gt;&gt; &gt; socket call will block and alarm will not get raised until TCP timeout<br>
&gt;&gt; &gt;&gt; &gt; occurs.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Interesting. So are you saying that read(2) cannot be interrupted by<br>
&gt;&gt; &gt;&gt; alarm signal if the system is configured not to return destination<br>
&gt;&gt; &gt;&gt; host unreachable message? Could you please guide me where I can get<br>
&gt;&gt; &gt;&gt; such that info? (I&#39;m not a network expert).<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; &gt; Not a C programmer, found some info that select call could be replace<br>
&gt;&gt; &gt;&gt; with<br>
&gt;&gt; &gt;&gt; &gt; select/pselect calls. Maybe it would be best if PGCONNECT_TIMEOUT<br>
&gt;&gt; value<br>
&gt;&gt; &gt;&gt; &gt; could be used here for connection timeout. pgpool has libpq as<br>
&gt;&gt; &gt;&gt; dependency,<br>
&gt;&gt; &gt;&gt; &gt; why isn&#39;t it using libpq for the healthcheck db connect calls, then<br>
&gt;&gt; &gt;&gt; &gt; PGCONNECT_TIMEOUT would be applied?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; I don&#39;t think libpq uses select/pselect for establishing connection,<br>
&gt;&gt; &gt;&gt; but using libpq instead of homebrew code seems to be an idea. Let me<br>
&gt;&gt; &gt;&gt; think about it.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; One question. Are you sure that libpq can deal with the case (not to<br>
&gt;&gt; &gt;&gt; return destination host unreachable messages) by using<br>
&gt;&gt; &gt;&gt; PGCONNECT_TIMEOUT?<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" target="_blank">http://www.sraoss.co.jp/index_en.php</a><br>
&gt;&gt; &gt;&gt; Japanese: <a href="http://www.sraoss.co.jp" target="_blank">http://www.sraoss.co.jp</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt;<br>
</div></div></blockquote></div><br>