<div dir="ltr"><div>The problem is always in the last place you checked..</div><div><br></div><div>On the postgresql pg_hba I had a /32 row for my pgpool IP address for trusted connection and one old (due to prior tests) /8 row matching with pgpool address, so sometimes postgresql accepted connections (matching with the "trust" rule) and sometimes refused them (matching with the md5 connection), setting the server as down.</div><div><br></div><div>Thanks a lot!</div><div>Matteo M.</div><br><br><div class="gmail_quote"><div dir="ltr">Il giorno ven 26 ott 2018 alle ore 15:13 Bo Peng <<a href="mailto:pengbo@sraoss.co.jp">pengbo@sraoss.co.jp</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
It seems that authentication failed failed when pgpool issues pg_is_in_recovery() to backends<br>
to find primary node.<br>
<br>
How did you configure pool_passwd, pool_hba.conf and pg_hba.conf?<br>
<br>
<br>
On Wed, 24 Oct 2018 16:27:03 +0200<br>
Matteo Monesi <<a href="mailto:matteo.monesi@carel.com" target="_blank">matteo.monesi@carel.com</a>> wrote:<br>
<br>
> Hi,<br>
> <br>
> I'm new to pgpool and I'm finding difficulties following the several guides<br>
> I found on web.<br>
> <br>
> I have 3 debian servers, 1 for pgpool (v 4.0.0) and 2 for the two<br>
> postgresql servers (v 10.5, one primary and one hot standby, using<br>
> streaming replication).<br>
> <br>
> My pgpool can find the 2 nodes, but it mark both of them as standby.<br>
>  node_id |  hostname   | port | status | lb_weight |  role   | select_cnt |<br>
> load_balance_node | replication_delay | last_status_change<br>
> ---------+-------------+------+--------+-----------+---------+------------+-------------------+-------------------+---------------------<br>
>  0       | 10.50.0.230 | 5432 | up     | 0.500000  | standby | 0          |<br>
> false             | 0                 | 2018-10-24 15:58:13<br>
>  1       | 10.50.0.232 | 5432 | up     | 0.500000  | standby | 0          |<br>
> true              | 0                 | 2018-10-24 15:58:13<br>
> Executing manually SELECT pg_is_in_recovery(); on the 2 postgresql server I<br>
> correctly obtain false for the primary and true for the standby.<br>
> <br>
> The connection to the 2 db works, I can send queries (with pgAdmin4) to<br>
> pgpool and I can receive answer from both the DB (pgpool do balancing, so I<br>
> can grow the 2 counter select_cnt).<br>
> <br>
> (I also tried with the previous pgpool version, 3.7.5, but I have a<br>
> different problem: node 0 is always detected as up, node 1 is always down,<br>
> don't mind which server I put as node 0 and node 1)<br>
> <br>
> I attach my pgpool config and the pgpool output.<br>
> <br>
> Any help is welcome!<br>
> Thank you<br>
> Matteo M.<br>
> <br>
> <br>
> ---------------------------------------------------------------------<br>
> pgpool.conf START -----------------------------------------------------<br>
> listen_addresses = '*'<br>
> port = 5432<br>
> socket_dir = '/var/run/postgresql'<br>
> <br>
> pcp_listen_addresses = '*'<br>
> pcp_port = 9898<br>
> pcp_socket_dir = '/var/run/postgresql'<br>
> listen_backlog_multiplier = 2<br>
> serialize_accept = off<br>
> <br>
> <br>
> backend_hostname0 = '10.50.0.230'<br>
> backend_port0 = 5432<br>
> backend_weight0 = 1<br>
> backend_data_directory0 = '/var/lib/postgresql/10/main'<br>
> backend_flag0 = 'ALLOW_TO_FAILOVER'<br>
> <br>
> backend_hostname1 = '10.50.0.232'<br>
> backend_port1 = 5432<br>
> backend_weight1 = 1<br>
> backend_data_directory1 = '/var/lib/postgresql/10/main'<br>
> backend_flag1 = 'ALLOW_TO_FAILOVER'<br>
> <br>
> enable_pool_hba = on<br>
> pool_passwd = 'pool_passwd'<br>
> authentication_timeout = 60<br>
> allow_clear_text_frontend_auth = off<br>
> <br>
> ssl = off<br>
> #ssl_key = './server.key'<br>
> #ssl_cert = './server.cert'<br>
> #ssl_ca_cert = ''<br>
> #ssl_ca_cert_dir = ''<br>
> <br>
> num_init_children = 32<br>
> max_pool = 4<br>
> <br>
> child_life_time = 300<br>
> child_max_connections = 0<br>
> connection_life_time = 0<br>
> client_idle_limit = 0<br>
> <br>
> log_destination = 'stderr'<br>
> log_line_prefix = '%t: pid %p: '   # printf-style string to output at<br>
> beginning of each log line.<br>
> log_connections = off<br>
> log_hostname = off<br>
> log_statement = off<br>
> log_per_node_statement = off<br>
> log_client_messages = off<br>
> log_standby_delay = 'if_over_threshold'<br>
> <br>
> syslog_facility = 'LOCAL0'<br>
> syslog_ident = 'pgpool'<br>
> log_error_verbosity = verbose<br>
> client_min_messages = debug5<br>
> log_min_messages = debug5<br>
> <br>
> pid_file_name = '/var/run/postgresql/pgpool.pid'<br>
> logdir = '/tmp'<br>
> <br>
> connection_cache = on<br>
> reset_query_list = 'ABORT; DISCARD ALL'<br>
> #reset_query_list = 'ABORT; RESET ALL; SET SESSION AUTHORIZATION DEFAULT'<br>
> <br>
> replication_mode = off<br>
> replicate_select = off<br>
> insert_lock = off<br>
> lobj_lock_table = ''<br>
> <br>
> replication_stop_on_mismatch = off<br>
> failover_if_affected_tuples_mismatch = off<br>
> <br>
> load_balance_mode = on<br>
> ignore_leading_white_space = on<br>
> white_function_list = ''<br>
> black_function_list = 'currval,lastval,nextval,setval'<br>
> black_query_pattern_list = ''<br>
> database_redirect_preference_list = ''<br>
> app_name_redirect_preference_list = ''<br>
> allow_sql_comments = off<br>
> disable_load_balance_on_write = 'transaction'<br>
> <br>
> master_slave_mode = on<br>
> master_slave_sub_mode = 'stream'<br>
> <br>
> sr_check_period = 10<br>
> sr_check_user = 'postgres'<br>
> sr_check_password = 'postgres'<br>
> sr_check_database = 'postgres'<br>
> delay_threshold = 10000000<br>
> <br>
> follow_master_command = ''<br>
> <br>
> health_check_period = 5<br>
> health_check_timeout = 20<br>
> health_check_user = 'postgres'<br>
> health_check_password = 'postgres'<br>
> health_check_database = 'postgres'<br>
> health_check_max_retries = 0<br>
> health_check_retry_delay = 1<br>
> connect_timeout = 10000<br>
> <br>
> failover_command = '/etc/pgpool2/4.0.0/failover.sh %d %P %H replication<br>
> /etc/postgresql/10/main/start_as_master'<br>
> failback_command = ''<br>
> failover_on_backend_error = on<br>
> detach_false_primary = off<br>
> search_primary_node_timeout = 300<br>
> <br>
> recovery_user = 'postgres'<br>
> recovery_password = 'postgres'<br>
> recovery_1st_stage_command = 'recovery_1st_stage.sh'<br>
> recovery_2nd_stage_command = ''<br>
> recovery_timeout = 90<br>
> client_idle_limit_in_recovery = 0<br>
> <br>
> use_watchdog = off<br>
> trusted_servers = ''<br>
> ping_path = '/bin'<br>
> wd_hostname = ''<br>
> wd_port = 9000<br>
> wd_priority = 1<br>
> wd_authkey = ''<br>
> wd_ipc_socket_dir = '/tmp'<br>
> <br>
> delegate_IP = ''<br>
> if_cmd_path = '/sbin'<br>
> if_up_cmd = 'ip addr add $_IP_$/24 dev eth0 label eth0:0'<br>
> if_down_cmd = 'ip addr del $_IP_$/24 dev eth0'<br>
> arping_path = '/usr/sbin'<br>
> arping_cmd = 'arping -U $_IP_$ -w 1'<br>
> <br>
> clear_memqcache_on_escalation = on<br>
> wd_escalation_command = ''<br>
> wd_de_escalation_command = ''<br>
> failover_when_quorum_exists = on<br>
> failover_require_consensus = on<br>
> allow_multiple_failover_requests_from_node = off<br>
> <br>
> wd_monitoring_interfaces_list = ''  # Comma separated list of interfaces<br>
> names to monitor.<br>
> wd_lifecheck_method = 'heartbeat'<br>
> wd_interval = 10<br>
> wd_heartbeat_port = 9694<br>
> wd_heartbeat_keepalive = 2<br>
> wd_heartbeat_deadtime = 30<br>
> <br>
> #heartbeat_destination0 = 'host0_ip1'<br>
> #heartbeat_destination_port0 = 9694<br>
> #heartbeat_device0 = ''<br>
> <br>
> #heartbeat_destination1 = 'host0_ip2'<br>
> #heartbeat_destination_port1 = 9694<br>
> #heartbeat_device1 = ''<br>
> <br>
> wd_life_point = 3<br>
> wd_lifecheck_query = 'SELECT 1'<br>
> wd_lifecheck_dbname = 'template1'<br>
> wd_lifecheck_user = 'nobody'<br>
> wd_lifecheck_password = ''<br>
> <br>
> #other_pgpool_hostname0 = 'host0'<br>
> #other_pgpool_port0 = 5432<br>
> #other_wd_port0 = 9000<br>
> #other_pgpool_hostname1 = 'host1'<br>
> #other_pgpool_port1 = 5432<br>
> #other_wd_port1 = 9000<br>
> <br>
> relcache_expire = 0<br>
> relcache_size = 256<br>
> check_temp_table = on<br>
> check_unlogged_table = on<br>
> <br>
> memory_cache_enabled = off<br>
> memqcache_method = 'shmem'<br>
> memqcache_memcached_host = 'localhost'<br>
> memqcache_memcached_port = 11211<br>
> memqcache_total_size = 67108864<br>
> memqcache_max_num_cache = 1000000<br>
> memqcache_expire = 0<br>
> memqcache_auto_cache_invalidation = on<br>
> memqcache_maxcache = 409600<br>
> memqcache_cache_block_size = 1048576<br>
> memqcache_oiddir = '/var/log/pgpool/oiddir'<br>
> white_memqcache_table_list = ''<br>
> black_memqcache_table_list = ''<br>
> <br>
> ---------------------------------------------------------------------<br>
> pgpool.conf END -----------------------------------------------------<br>
> <br>
> ---------------------------------------------------------------------<br>
> pgpool.log -----------------------------------------------------<br>
> The output is too long for an email (10k rows for 1 minute and half).<br>
> It is available here:<br>
> <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_1fho2gh4JTBgjiY6bHlpUQAkB8tjS2ute_view-3Fusp-3Dsharing&d=DwICAg&c=z7ZdhQWiOKyPuOPFlqJIyw&r=EozxJ07eZdUti5lcY_lysVNm7ciSa1TsqyT6WzR_9a8&m=ORNMZLjeUsGnk07Sf8TZN7cY8U1Dmn4RYOq0qzfV2vk&s=41KgNMhRNmKpkc8Dd6z0JMVVgEyfURMonRBJNd6TEyk&e=" rel="noreferrer" target="_blank">https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_1fho2gh4JTBgjiY6bHlpUQAkB8tjS2ute_view-3Fusp-3Dsharing&d=DwICAg&c=z7ZdhQWiOKyPuOPFlqJIyw&r=EozxJ07eZdUti5lcY_lysVNm7ciSa1TsqyT6WzR_9a8&m=ORNMZLjeUsGnk07Sf8TZN7cY8U1Dmn4RYOq0qzfV2vk&s=41KgNMhRNmKpkc8Dd6z0JMVVgEyfURMonRBJNd6TEyk&e=</a><br>
<br>
<br>
-- <br>
Bo Peng <<a href="mailto:pengbo@sraoss.co.jp" target="_blank">pengbo@sraoss.co.jp</a>><br>
SRA OSS, Inc. Japan<br>
<br>
</blockquote></div></div>