[pgpool-general: 899] How can I automate actions when synchronous standby fails?

MauMau maumau307 at gmail.com
Sat Aug 18 00:38:32 JST 2012


Hello,

I'm thinking of using pgpool-II 3.2 to automate failover in synchronous 
streaming replication.  Please let me ask some questions for which I 
couldn't find clear answers in the pgpool-II manual.

The system consists of the following nodes:

dbnode0: DB server (initially primary server)
dbnode1: DB server (initially standby server)
appnode1...appnodeN: application servers; Java EE servers and pgpool run on 
all of them

[relevant settings in pgpool.conf]
backend_hostname0 = dbnode0
backend_port0 = 5432
backend_hostname1 = dbnode1
backend_port1 = 5432

According to the current specification of synchronous streaming replication, 
the applications hang when the standby goes down.  To resume those hung 
applications, I want to set synchronous_standby_names to '' and reload 
postgresql.conf automatically when the standby stops for any reason.  The 
related description in the manual is:

http://www.postgresql.org/docs/9.1/static/warm-standby.html#SYNCHRONOUS-REPLICATION

[excerpt]
If you really do lose your last standby server then you should disable 
synchronous_standby_names and reload the configuration file on the primary 
server.


Q1
How can I achieve this with pgpool?  Is failover_command invoked when the 
standby stops working?


Q2
What do the following special characters mean in failover_command 
description?  How does "master" differ from "primary"?  In my configuration, 
what values do they provide when the standby (dbnode1) goes down?

%M Old master node ID.
%P Old primary node ID.


Q3
What kind of problems could occur when many pgpool instances on the 
application servers invoke failover_command simultaneously and independently 
of one another?  What should I do to avoid those potential problems?


Q4
I found the below sentence in pgpool manual.  Does this apply even when the 
standby fails?  If yes, I would like to know any workaround or reason, 
because I believe standby failure should not affect application processing 
which is performed on the normal primary.

"When a failover is performed, pgpool kills all its child processes, which 
will in turn terminate all active sessions to pgpool."


Regards
MauMau



More information about the pgpool-general mailing list