[pgpool-general: 6261] Re: Error detecting primary server with pgpool-II 4.0.0

Matteo Monesi matteo.monesi at carel.com
Mon Oct 29 22:35:01 JST 2018


The problem is always in the last place you checked..

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.

Thanks a lot!
Matteo M.


Il giorno ven 26 ott 2018 alle ore 15:13 Bo Peng <pengbo at sraoss.co.jp> ha
scritto:

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


More information about the pgpool-general mailing list