Thread: PgSql 9.4 onwards

PgSql 9.4 onwards

From
Vikas Sharma
Date:
Hi,

We are using PgSql 9.4 & 9.5 with repmgr 3.5. 
Repmgr works properly and great in promoting a standby to Master when automatic failover is enabled. 

The issue we have is with the old master, if master was unavailable due to network problem, though pgSql was up and running on it we end up with 2 masters. 

Another scenario is with VMs we have databases on. Whenever VMs are started, sometimes Standby VMs starts first and then again we end up with 2 masters.

Is there a way that the old master  shoot/ stop itself when the standby is promoted to master and as soon as the network is restored?

Is there a way to stop the pgSql starting up on standby if master is not available yet?

For the 2nd question I have a feeling that I should create a shell script ( and call when pgSql starts) to check the state of pgSql on the server, e.g if this a standby don't start it up if master not available, if this is master and other replicated node is promoted to master then don't start it up. I am not sure if I can cover all the permutations and combinations.

Let me know please if someone had done something like this.

Regards
Vikas