[pgpool-general: 2161] Re: pgpool is taking wrong node for a master

Tatsuo Ishii ishii at postgresql.org
Wed Sep 25 22:10:27 JST 2013

> Hello,
> i have a little problem, or scenario that is happening and that I want to
> avoid.
> Here is scenario:
> I have two nodes named node1, and node2. node1 is primary, node2 is standby.
> - node1 fails
> - pgpool promote node2 to primary

Apparently you restart node1 at this point.

> - i restart pgpool service for whatever reason
> - pgpool is taking old primary (node1),to be primary again, even last state
> was that node2 is primary
> - pgpool is working with node1 as primary for some time, with old data
> After this,it is hard to check which node have newer data, and its hart not
> to lose one piece of data.
> How it is possible that pgpool take node1 as primary even if last state was
> that node2 was primary?

Because you restart node1 before restarting pgpool-II. Pgpool-II
checks nodes one by one according to the order that they are written
in pgpool.conf. Since pgpool-II finds that node1 is the primary, it
assumes node1 is the primary. This could happen of if you restart
pgpool-II with -D option, pgpool-II forgets previous node status.

> What is the best practice for this kind of situation?

Retart pgpool-II without -D option. Pgpool will remember that node1
was down before and avoid to choose node1 as the primary.
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

More information about the pgpool-general mailing list