Thread: Postgres 9.6 active-passive HA cluster

Postgres 9.6 active-passive HA cluster

From
Jairam Gauns
Date:
Hi guys,

 

We are in process of testing a Postgres 9.6 active-passive HA cluster using

streaming replication on Rhel 7.6.

We have setup Postgres 9.6 primary/warm standby streaming synchorous replication.

We have set synchronous_standby_names=* and synchronous_commit=on.

 

To test we have 5 sql clients firing inserts simultaneously on the 12 tables created on a db present on the primary. each client would end up firing 2000 request.

So when i run this experiment, i kill postgres on primary say after 8000 records are inserted.

Then i start both nodes as standalone to compare the data.

 

So once in a while i observe that  there exist one record more in a few tables on the killed  primary than as compared to the records on the standby.

Our expectation is both servers should have same number of records when we set synchronous replication. Because if that does not happen and now i make the failed primary the new standby then the records would not be saved as the new primary(old standby) did not have them in the first place.
How do we handle this situation?

 

Could anybody please help provide some pointers?

Thanks
Jairam

Re: Postgres 9.6 active-passive HA cluster

From
Michael Lewis
Date:
"pg_rewind is a tool for synchronizing a PostgreSQL cluster with another copy of the same cluster, after the clusters' timelines have diverged. A typical scenario is to bring an old master server back online after failover as a standby that follows the new master."