Configuring PostgreSQL high availability

To help maintain continuous operations, you can set up your environment for high availability (HA). Disaster recovery is the process of restoring the service to a production state during an outage. IBM® Cloud Application Business Insights uses PostgreSQL to store the application data.

About this task

Typically, a high availability solution for any RDBMS must handle the following scenarios:
  • Replication
  • Failover
  • Recovery
In this high availability solution, Patroni, which is a cluster manager is used to customize and automate deployment and maintenance of PostgreSQL HA clusters.

Patroni is an open source tool suite, which is written in Python and ensures the end-to-end setup of PostgreSQL HA clusters, including streaming replication. Its functions are displayed through REST APIs and also with a command-line utility called patronictl. It supports integration with HAProxy by using its health check APIs to handle load balancing. In this HA solution, etcd is used for distributed configuration store (DCS) for maximum accessibility.

PostGreSQL HA setup
CAUTION:
  • The software that is used to create highly available PostgreSQL cluster fall under category of open source software. However, it is recommended to speak with your legal team before you use it for production use.
  • The authentication for Patroni, etcd, HAProxy applications is out of scope of the document. It is assumed that you either installed them on isolated secure network or secured them with appropriate authentication mechanism.