![](http://1.bp.blogspot.com/-75VJp3TaigM/XlT0rNYY_DI/AAAAAAAASaY/BkpBFbklDiEy0QHdPb_MRTpmohkCdOQBQCLcBGAsYHQ/s1600/postgresql_cluster_centos.png)
This step by step guide will show you how to set up a highly available PostgreSQL cluster using Patroni and HAProxy on CentOS or RHEL 7 server. These instruction can also be applied (slight changes may be required) if you are running an earlier release of CentOS or RHEL 6.
Prerequisites
To follow this tutorial, you will need 4 (physical or virtual) machines with CentOS or RHEL 7 minimal installed, having sudo non-root user privileges.
We have prepared following 4 machines with CentOS Linux release 7.7.1908 for this guide. However, if you wish you can add up more machines in your cluster environment.
We have prepared following 4 machines with CentOS Linux release 7.7.1908 for this guide. However, if you wish you can add up more machines in your cluster environment.
HOSTNAME | IP ADDRESS | PURPOSE |
node1 | 192.168.10.1 | Postgresql, Patroni |
node2 | 192.168.10.2 | Postgresql, Patroni |
node3 | 192.168.10.3 | etcd |
node4 | 192.168.10.4 | HAProxy |
When you are ready with the above prerequisites , follow step by step guide to set up PostgreSQL high availability cluster in your environment.