[Pgpool-hackers] path to follow master after a failover

Gilles Darold gilles.darold at dalibo.com
Wed Jan 26 23:35:22 UTC 2011


Hi,

Sorry for the delay, here is the patch that add a new configuration
directive 'follow_master_command'.

After each master failover only and if the directive contains a command
line, PgPool will degenerate all desynchronized SR backend and will
executed the command when new master is up. This allow to set a bash
script or other program to force the reconstruction of all secondary
servers.

A typical follow master shell script will do :

    #!/bin/sh
    PGPOOLIP=192.168.1.10
    PGUSER=postgres
    PGPASS=pcp_pass_phrase

    /usr/local/pgpool/bin/pcp_recovery_node 10 $PGPOOLIP 9898 $PGUSER
    $PGPASS $1
    /usr/local/pgpool/bin/pcp_attach_node 10 $PGPOOLIP 9898 $PGUSER
    $PGPASS $1

and the follow_master_command will be set like this in pgpool.conf:

    # Execute command at end of failover.
    # special values:  %d = node id
    #                  %h = host name
    #                  %p = port number
    #                  %D = database cluster path
    #                  %m = new master node id
    #                  %H = hostname of the new master node
    #                  %M = old master node id
    #                  %P = old primary node id
    #                  %% = '%' character
    #
    follow_master_command = '/home/postgres/bin/follow_master.sh %d'

This is a first try, as I only use PgPool with Pg Streaming Replication,
I don't know if it breaks something in the other modes. But that I've
tried to do with this path and the other one which allow promoting any
node as master is to change the less possible the actual code. So there
should not be any problem with other mode and if so it could be simply
fixed. Any feedback will be appreciated.

Thanks for your help,

Regards,

-- 
Gilles Darold
http://dalibo.com - http://dalibo.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pgfoundry.org/pipermail/pgpool-hackers/attachments/20110127/a8c0be6b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgpool-II-follow.diff
Type: text/x-patch
Size: 10647 bytes
Desc: not available
URL: <http://pgfoundry.org/pipermail/pgpool-hackers/attachments/20110127/a8c0be6b/attachment.bin>


More information about the Pgpool-hackers mailing list