MENU

Fun & Interesting

High Availability PostgreSQL with Patroni – Full Setup Tutorial

Techno Tim 32,683 5 months ago
Video Not Working? Fix It Now

Ready to take PostgreSQL to the next level? In this in-depth tutorial, we’ll walk through setting up a self-hosted, production-ready PostgreSQL cluster with high availability, automatic failover, and scalability in mind. We’re doing it all from scratch using: - PostgreSQL - Patroni - etcd - HAProxy - Keepalived By the end of this video, you’ll have a solid, battle-tested setup that keeps your database online—even if a node goes down. Video Notes: https://technotim.live/posts/postgresql-high-availability/ Merch Shop ?️: https://l.technotim.live/shop Support me on Patreon: https://www.patreon.com/technotim Sponsor me on GitHub: https://github.com/sponsors/timothystewart6 Subscribe on Twitch: https://www.twitch.tv/technotim Become a YouTube member: https://www.youtube.com/channel/UCOk-gHyjcWZNj3Br4oxwh0A/join Gear Recommendations: https://l.technotim.live/gear Get Help in Our Discord Community: https://l.technotim.live/discord 2nd channel: https://www.youtube.com/@TechnoTimTinkers (Affiliate links may be included in this description. I may receive a small commission at no cost to you.) 00:00 - Intro 01:17 - Components that make a HA Postgres Cluster 02:18 - etcd's Role 02:41 - Patroni's Role 03:51 - HA Proxy's Role 05:22 - keepalived's role 06:24 - Documentation 06:33 - Requirements 08:06 - Automation? 08:51 - Installing PostgreSQL 09:53 - Install etcd 12:47 - etcd Certificates 18:01 - Configuring etcd 22:58 - Starting etcd 23:20 - Verifying etcd cluster 25:29 - Configuring Postgres & Patroni 25:51 - Postgres Certificates 27:53 - Certificate ACLs 28:48 - Installing Patroni 29:05 - Configuring Patroni 34:00 - Patroni Certificates 34:44 - Starting Patroni (and our HA Cluster!) 35:49 - Reconfiguring etcd Cluster 36:38 - Verifying our Cluster with Patroni 37:18 - Installing HA Proxy 38:08 - Configuring HA Proxy 40:43 - Starting HA Proxy 41:15 - Installing keepalived 41:46 - Configuring keepalived 45:59 - Starting keepalived 46:29 - Verifying keepalived 46:43 - Connecting to Cluster with PGAdmin 48:06 - Creating Data in our HA Cluster 48:54 - Testing HA: Taking Down a Postgres Node 50:38 - Testing HA: Taking Down HA Proxy & keepalived Nodes 51:50 - Testing HA: Bringing Nodes Up and Verifying Replication 53:58 - More HA Content Coming Thank you for watching!

Comment