<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection">
<div dir="auto">Hello<br />
<br />
I was following <a href="https://b-peng.blogspot.com/2021/07/deploying-pgpool2-exporter-with-docker.html" target="_blank">this amazing tutorial</a> by Bo Peng to setup a pgpool cluster with pgpool exporter. The setup went fine and I was able to run the exporter successfully, but on further testing, I found something strange. The setup works fine for a few mins, but after that, even without any activity on the primary or standby, pgpool throws an "authentication failed, password authentication failed for user “postgres”” error and performs a failover. Here are the logs-<br />
<br />
Configuring Pgpool-II...<br />
No custom pgpool.conf detected. Use environment variables and default config.<br />
Starting Pgpool-II...<br />
2021-10-06 17:19:27: pid 20: LOG: Backend status file /tmp/pgpool_status does not exist<br />
2021-10-06 17:19:27: pid 20: LOG: health_check_stats_shared_memory_size: requested size: 12288<br />
2021-10-06 17:19:27: pid 20: LOG: memory cache initialized<br />
2021-10-06 17:19:27: pid 20: DETAIL: memcache blocks :64<br />
2021-10-06 17:19:27: pid 20: LOG: allocating (136555320) bytes of shared memory segment<br />
2021-10-06 17:19:27: pid 20: LOG: allocating shared memory segment of size: 136555320 <br />
2021-10-06 17:19:27: pid 20: LOG: health_check_stats_shared_memory_size: requested size: 12288<br />
2021-10-06 17:19:27: pid 20: LOG: health_check_stats_shared_memory_size: requested size: 12288<br />
2021-10-06 17:19:27: pid 20: LOG: memory cache initialized<br />
2021-10-06 17:19:27: pid 20: DETAIL: memcache blocks :64<br />
2021-10-06 17:19:27: pid 20: LOG: pool_discard_oid_maps: discarded memqcache oid maps<br />
2021-10-06 17:19:27: pid 20: LOG: Setting up socket for 0.0.0.0:9999<br />
2021-10-06 17:19:27: pid 20: LOG: Setting up socket for :::9999<br />
2021-10-06 17:19:27: pid 20: LOG: find_primary_node_repeatedly: waiting for finding a primary node<br />
2021-10-06 17:19:28: pid 20: LOG: find_primary_node: primary node is 0<br />
2021-10-06 17:19:28: pid 20: LOG: find_primary_node: standby node is 1<br />
2021-10-06 17:19:28: pid 54: LOG: PCP process: 54 started<br />
2021-10-06 17:19:28: pid 57: LOG: process started<br />
2021-10-06 17:19:28: pid 56: LOG: process started<br />
2021-10-06 17:19:28: pid 55: LOG: process started<br />
2021-10-06 17:19:28: pid 20: LOG: pgpool-II successfully started. version 4.2.3 (chichiriboshi)<br />
2021-10-06 17:19:28: pid 20: LOG: node status[0]: 1<br />
2021-10-06 17:19:28: pid 20: LOG: node status[1]: 2<br />
2021-10-06 17:19:28: pid 47: LOG: pool_reuse_block: blockid: 0<br />
2021-10-06 17:19:28: pid 47: CONTEXT: while searching system catalog, When relcache is missed<br />
2021-10-06 17:19:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:19:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:19:53: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:19:53: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:03: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:03: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:13: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:13: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:23: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:23: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:33: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:33: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:53: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:20:53: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:03: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:03: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:13: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:13: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:23: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:23: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:33: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:33: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:48: pid 57: ERROR: authentication failed<br />
2021-10-06 17:21:48: pid 57: DETAIL: password authentication failed for user "postgres"<br />
2021-10-06 17:21:48: pid 57: LOG: health check failed on node 1 (timeout:0)<br />
2021-10-06 17:21:48: pid 57: LOG: received degenerate backend request for node_id: 1 from pid [57]<br />
2021-10-06 17:21:48: pid 20: LOG: Pgpool-II parent process has received failover request<br />
2021-10-06 17:21:48: pid 20: LOG: starting degeneration. shutdown host postgres_replica(5432)<br />
2021-10-06 17:21:48: pid 20: LOG: Do not restart children because we are switching over node id 1 host: postgres_replica port: 5432 and we are in streaming replication mode<br />
2021-10-06 17:21:48: pid 20: LOG: failover: set new primary node: 0<br />
2021-10-06 17:21:48: pid 20: LOG: failover: set new main node: 0<br />
failover done. shutdown host postgres_replica(5432)2021-10-06 17:21:48: pid 20: LOG: failover done. shutdown host postgres_replica(5432)<br />
2021-10-06 17:21:48: pid 55: LOG: worker process received restart request<br />
2021-10-06 17:21:49: pid 54: LOG: restart request received in pcp child process<br />
2021-10-06 17:21:49: pid 20: LOG: PCP child 54 exits with status 0 in failover()<br />
2021-10-06 17:21:49: pid 20: LOG: fork a new PCP child pid 58 in failover()<br />
2021-10-06 17:21:49: pid 20: LOG: worker child process with pid: 55 exits with status 256<br />
2021-10-06 17:21:49: pid 58: LOG: PCP process: 58 started<br />
2021-10-06 17:21:49: pid 20: LOG: fork a new worker child process with pid: 59<br />
2021-10-06 17:21:49: pid 59: LOG: process started<br />
2021-10-06 17:21:53: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:21:53: pid 47: LOG: status_changed_time 1633540908<br />
2021-10-06 17:22:03: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:22:03: pid 47: LOG: status_changed_time 1633540908<br />
2021-10-06 17:22:13: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:22:13: pid 47: LOG: status_changed_time 1633540908<br />
2021-10-06 17:22:23: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:22:23: pid 47: LOG: status_changed_time 1633540908<br />
2021-10-06 17:22:33: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:22:33: pid 47: LOG: status_changed_time 1633540908<br />
2021-10-06 17:22:43: pid 47: LOG: status_changed_time 1633540768<br />
2021-10-06 17:22:43: pid 47: LOG: status_changed_time 1633540908<br />
2021-10-06 17:22:53: pid 47: LOG: status_changed_time 1633540768<br />
<br />
As you will see in the logs, there’s no activity on my side and I have tried this multiple times and it always shows the same behaviour. I didn’t change anything in the configuration from Bo’s tutorial. Though I have added an additional Prometheus and Alertmanager in front of it. Here’s the configuration for those-<br />
<br />
prometheus:<br />
 restart: unless-stopped<br />
 ports:<br />
 - "9090:9090"<br />
 volumes:<br />
 - ./prometheus/config.yml:/etc/prometheus/prometheus.yml<br />
 - ./prometheus/alert_rules.yml:/etc/prometheus/alert_rules/alert_rules.yml<br />
 depends_on:<br />
 - pgpool2_exporter<br />
 image: "prom/prometheus"<br />
<br />
 alertmanager:<br />
 restart: unless-stopped<br />
 volumes:<br />
 - ./prometheus-alertmanager/config.yml:/etc/alertmanager/alertmanager.yml<br />
 depends_on:<br />
 - prometheus<br />
 image: "quay.io/prometheus/alertmanager"<br />
<br />
<br />
I don’t think prometheus or the alertmanager are causing any problems but I am unable to figure out why pgpool is doing a failover after several minutes of running fine.<br />
<br />
Thanks in advance!<br />
<br />
Anirudh</div>
</div>
</body>
</html>