PostgreSQL – Creating a High Availability Database Cluster with Open Source Software

barmanhigh-availabilitypgbouncerpostgresqlrepmgr

If use these tools can make a great modern database cluster with full features:

  • pgbouncer (with HAProxy for HA)
  • repmgr
  • barman

The main database will run on the repmgr servers. It has primary and standby. If primary down, standby can up. But will take some seconds. At that time, user can't access the database by pending? Isn't there has a good way to make realtime response?

Best Answer

With all high-availability solutions you will always have some down-time during a failover, typically less than a minute.

The reason is that the clusterware has to determine reliably that a member is down before it can fail over. That means that failover is only initiated after several attempt to communicate with the cluster member have failed.

You can reduce failover time by making these tests try less often, but that increases the risk of an unnecessary failover (for example, caused by a one-time network glitch). Unnecessary failovers reduce the total uptime of your database, so you don't win anything that way.