[Pgpool-general] how to find node role and order of scripts being run

Jeff Frost jeff at pgexperts.com
Wed Oct 5 03:26:24 UTC 2011


On Oct 4, 2011, at 5:42 PM, Tatsuo Ishii wrote:

>>> In Streaming replication mode, how do I find which node is currently which
>>> role?  That is, I'd like to know which node is considered the primary and
>>> which are replicas. 
> 
> You can use standard PostgreSQL function pg_is_in_recover() to get the
> information. It's not necessarily identical to what pgpool-II thinks,
> but since pgpool-II also uses the function to judge which is which,
> you could assume that what pg_is_in_recover() returns is what
> pgpool-II thinks in real world.
> 
> It would be nice if pcp command returns that info directly though.

Ah, ok, so no way to find out what pgpool thinks internally. Drat!

I ask because I'm trying to troubleshoot some scripts and with 3 active nodes, detaching node 0 causes the system to failover properly to node 1, but if I recover node 0, then detach node 1, the log indicates it can't find a primary node and the failover script eventually gets a -1 as the 'new master node'.  I'll try comparing the recovery state to see if that disagrees with what I think is actually happening.

How does pgpool use the pg_is_in_recovery() function?



---
Jeff Frost <jeff at pgexperts.com>
CTO, PostgreSQL Experts, Inc.
Phone: 1-888-PG-EXPRT x506
FAX: 415-762-5122
http://www.pgexperts.com/ 








More information about the Pgpool-general mailing list