[pgpool-general: 7474] Promote specific backend to primary in streaming replication

Nathan Ward lists+pgpool at daork.net
Sat Apr 3 12:39:47 JST 2021

Hi all,

I'm busy upgrading to postgres 13 and pgpool 4.1.4, and as part of that
reworking some of our scripts and improving some of our operational

I'd like to have a way to promote a specific backend to primary, and have
the old primary use pg_rewind, then connect to the new primary.

I'm using scripts largely based on the samples, though without
pg_basebackup as a fallback to pg_rewind - our thinking is if pg_rewind
fails, we want to leave it in the current state and investigate, then
restore manually.

I can run pcp_detach_node to almost achieve this controlled primary
failover, but it doesn't let me specify which primary to fail over to.
pcp_promote_node explicitly says it's only about internal pgpool state, and
it runs follow_master_command, but not failover_command.

Is there a way to achieve this in pgpool at the moment? If not, could we
put together a new feature / command to achieve this? (Happy to contribute
code, if this is something that would be useful).
1) Detach old primary
2) Run failover_command on the new primary
3) Run follow_master_command on the standbys (including the old primary,
which gets reattached by the script)

Perhaps this is an extra flag on pcp_promote_node which causes
failover_command to run?

Nathan Ward
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pgpool.net/pipermail/pgpool-general/attachments/20210403/7792e89a/attachment.htm>

More information about the pgpool-general mailing list