[pgpool-general: 4798] Re: 3 or more postgres backends and failover.

Tatsuo Ishii ishii at postgresql.org
Thu Jul 21 08:12:57 JST 2016

> Hello.
> I have a following configuration:
> 2 equivalent pgpool nodes with a virtual IP.
> 3 postgres backends (1 master, 1 synchronous slave, 1 asynchronous
> slave) with the same weights.
> My question is: how does pgpool determine, which node will become the
> next master on the current master death? My tests shoved that both
> slaves can become masters, and i cant determine why one is selected.

I assume "master" is "primary".

The answer is, pgpool does not have any built-in logic to determine
new master. It totally depends on how you write a fail over script.

For example, in the sample fail over script of pgpool_setup (which is
coming with pgpool-II source code), "new master node" is the next
primary. The "new master node" is the node which has youngest
PostgreSQL node id among live nodes. Suppose you have 3 nodes: node 0
(primary), node 1 (standby) node 2 (standby). If node 0 goes down,
node 1 will be the new primary. If node 1 is not alive, then node 2
will be the new primary. etc. according to the logic defined in the
fail over script.

Best regards,
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php

More information about the pgpool-general mailing list