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

Tatsuo Ishii ishii at postgresql.org
Thu Jul 21 16:13:47 JST 2016

>> 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.
> I thought that failover script was executed after new primary node was
> determined by pgpool. How does failover script logic matter, if it is
> already executed with new primary id?

Because pgpool-II does not automatically promote standby, when fail
over gets called, new primary is not defined yet. It is the fail over
script's responsibility to promote a standby.

> Ok, youngest node id makes sense. Thanks. But why does it needs to
> start with 0? As i understand, its an arbitrary number set in config
> file, but when i set backends starting with "backend1_*", i've got
> empty node with node_id 0 in "show pool_nodes".

That's how pgpool-II is implemented. Do you have any specific reason
to want to start with backend1_*, rather than backend_0*?

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