![](http://1.bp.blogspot.com/-9eIT7aBTk78/Xk9eH35ELpI/AAAAAAAASW4/uDU0YQi3DqQgTZkfgOLzyxrxY05ZHgpDQCLcBGAsYHQ/s1600/scalable-and-highly-available-postgres-cluster.jpg)
This tutorial will take you through the steps to set up a highly available PostgreSQL cluster using Patroni and HAProxy on an Ubuntu 19 server. These instruction can also be applied (slight changes may be required) if you are running an earlier release of Ubuntu 16/17/18 or latest release of Ubuntu 20.04.
Prerequisites
To follow the steps covered in this tutorial, you will need five (physical or virtual) machines installed with Ubuntu (18.04, 19.04/10 or 20.04) server having sudo non-root user privileges.
HOSTNAME | IP ADDRESS | PURPOSE |
NODE1 | 192.168.10.1 | Postgresql, Patroni |
NODE2 | 192.168.10.2 | Postgresql, Patroni |
NODE3 | 192.168.10.3 | Postgresql, Patroni |
NODE4 | 192.168.10.4 | etcd |
NODE5 | 192.168.10.5 | HAProxy |
Please follow the steps by steps guide to set up PostgreSQL High Availability cluster in your environment.