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

Tema Zelikin gunslinger at nightflame.info
Thu Jul 21 17:01:14 JST 2016

21.07.2016 10:13, Tatsuo Ishii пишет:
>>> 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.
Ah, i see. As i understood, pgpool makes a suggestion which standby
should be promoted, but which one would actually be promoted is
determined by failover script. Thanks.

>> 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*?
Not as such, no. Its just when i use pgpool in conjunction with repmgr
(which also uses arbitrary node ids), i want to use the same ids and not
always start with 0. Just a matter of good looks.

More information about the pgpool-general mailing list