[pgpool-hackers: 3954] Determine which node to promote (prefer one with lesser replication lag)

anirudh.goel at cern.ch anirudh.goel at cern.ch
Fri Jul 9 20:30:33 JST 2021


Hello

I have a setup with 1 primary, 2 synchronous standbys behind 1 pgpool without watchdog.

“SHOW POOL_NODES;" displays Node 2 as the synchronously replicated node and Node 1 as the “potential" node. But when the current master dies and failover happens, pgpool promotes Node 1 instead of 2.


postgres=# show pool_nodes;
 node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | replication_state | replication_sync_state | last_status_change
---------+----------------------+------+--------+-----------+---------+------------+-------------------+-------------------+-------------------
0 | dbod-ag-pg01.ch | 6601 | up | 0.333333 | primary | 1 | true | 0 | | | 2021-07-08 21:45:45
1 | dbod-ag-pg02.ch | 6604 | up | 0.333333 | standby | 0 | false | 0 | streaming | potential | 2021-07-09 05:49:24
2 | dbod-ag-pg03.ch | 6600 | up | 0.333333 | standby | 0 | false | 0 | streaming | sync | 2021-07-08 21:50:43
(3 rows)


My query is that, is there a way to tell pgpool to promote the standby with lesser replication lag? I plan to use synchronous replication with “remote_write” (and not remote_apply) level, so it’s quite possible that a replication lag will persist.

Also, I have another query - At the time of starting up of pgpool, if one of the (standby) nodes provided in the initial backend configuration is not alive, pgpool continuously waits up to reach that node without starting up. Is there a way to start pgpool by ignoring that node in such a case? Should I send you a separate mail for this query?

Thanks in anticipation!

Anirudh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-hackers/attachments/20210709/5ad1a4f5/attachment.htm>


More information about the pgpool-hackers mailing list