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

Tatsuo Ishii ishii at sraoss.co.jp
Mon Apr 5 15:13:13 JST 2021

> Ah - I had not thought of this option. However, doesn't failover_command
> get told what the new primary will be, rather than being able to decide
> this itself (%m %H %r %R)?

No. Actually failover_command always decides what the new primary will

"New main node" means the live node (not in down status) which has the
youngest node id. Usually (and our sample script) just chooses the new
main node as the candidate of new primary because it's the easiest
way. (otherwise the script must check whether new primary candidate is
actually up or not).

>> With this change you can do:
>> 1) explicitly specify the new primary node
>> 2) run pcp_detach_node against the current primary and the current
>>    primary nodes goes into down status
>> 3) failover_command will run to make the specified standby node to be
>>    new primary
>> 4) follow_primary_command will run on rest of standbys and the old
>>    primary to follow the new primary
> I think this would work yes - which is very close to what I was suggesting
> with a flag on pcp_promote_node. If this requires 2 commands
> (pcp_set_next_primary or something, then pcp_detach_node) I would wrap them
> in a single script which runs both in order to keep things simple and fast
> for our operations team.

Wrapping pcp_set_next_primary or something, and pcp_detach_node looks
nice idea because it's flexible. Even you could look for a node which
has the least replication delay and let the node be the next primary.

Best regards,
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php

More information about the pgpool-general mailing list