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

Tema Zelikin gunslinger at nightflame.info
Thu Jul 21 15:52:53 JST 2016

On 21.07.2016 2:12, Tatsuo Ishii wrote:
>> 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.
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?

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".

More information about the pgpool-general mailing list