pgpool / pgpool2

This is the official mirror of git://git.postgresql.org/git/pgpool2.git. Note that this is just a *mirror* - we don't work with pull requests on github. Please subscribe to pgpool-hackers mailing list from our website and submit your patch to this mailing list.
https://www.pgpool.net
Other
343 stars 91 forks source link

Follow primary command not triggered following a successful primary node failover #65

Open lukaszdobrzynski opened 3 months ago

lukaszdobrzynski commented 3 months ago

According to the docs follow_primary_command specifies a user command to run after failover on the primary node failover. Typically follow_primary_command is used to recover the standby from the new primary.
While failover_command works perfectly well and runs a script to promote the standby node to a new primary, the follow_primary_command is not triggered after the successful promotion, which is something I'd expect to happen next.

The pgpool.conf setup contains the following entries:

backend_clustermode = 'streaming_replication'
failover_command = '/var/pgpool-failover.sh %d %h %p %D %m %M %H %P '
follow_primary_command = '/var/pgpool-follow-primary.sh %d %h %p %D %m %H %M %P %r %R '

The pgpool-failover.sh script does the following:

ssh postgres@$new_master_host_name 'repmgr -f /etc/repmgr.conf standby promote'

The pgpool-follow-primary.sh is expected to create a log entry for testing purposes, yet no entry is created in the system, so I assume the command is not invoked by the pgpool:

touch /var/follow-primary-log && echo "Follow  primary command triggered!" >> /var/follow-primary-log

Is there anything I might be missing here or do not understand about follow_primary_command option?

pengbo0328 commented 3 months ago

@lukaszdobrzynski Pgpool will execute follow_primary_command on all nodes except the new primary.

Did you see the following log in pgpool log?

=== Starting follow primary command for node X ===
LOG:  execute command: /path/to/follow_primary.sh ...