[pgpool-general: 2409] Re: Streaming replication: promoting the only alive backend server on pgpool start

Tatsuo Ishii ishii at postgresql.org
Wed Jan 15 08:13:13 JST 2014

> Hi!
> Say we have a degraded master-slave backend with only one server alive which is currently slave. Master is dead, slave is alive. Pgpool is switched off (it is essential). 
> Now I switch on pgpool2 service and it shows the following status:
> postgres=# show pool_nodes;
>  node_id |   hostname    | port | status | lb_weight |  role
> ---------+---------------+------+--------+-----------+---------
>  0       | db-node1.site | 5432 | 2      | 0.500000  | standby
>  1       | db-node2.site | 5432 | 3      | 0.500000  | standby
> (2 rows)
> The only alive server is standby. 
> And also I cannot see anything related to failover in pgpool log. 
> So the question is - is there a way for pgpool to detect ON START that the only alive server is in standby state and automatically promote it to master by running failover command or something similar? 

Yes. You just start pgpool with "-D" option, which discards the
previous node error status. I guess the reason why you don't see
failover in the log is, pgpool thinks that "oh I saw node 1 was down
before, so why I have to be bothered by the it. Let's ignore node

In the mean time, I found that if node 0 is down, pgpool fails to find
node 1 is primary. Pgpool ignores down nodes while looking for the
primary node. Usually this works well. However if the failed node is
not found *before* the look-for-primary-node is executed, the
assumption will be failed. Included is the patch to solve the problem
(against pgpool-II 3.3 stable).

Best regards,
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: primary_node_detection.patch
Type: text/x-patch
Size: 571 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-general/attachments/20140115/e0e3a541/attachment.bin>

More information about the pgpool-general mailing list