SlideShare a Scribd company logo
PostgreSQL - High
Availability
Muhammad Haroon
PUG August 2016, Islamabad
Agenda
● A typical workflow in DR
● Why does everyone talk about it ?
● What is HA after all ?
● PostgreSQL HA
● PostgreSQL HA + Linux modus vivendi
Who am I ??
● Working in PostgreSQL space @ 2ndQuadrant
● Part of PostgreSQL family for over 10 years
● Work in almost all areas around PostgreSQL from development to professional
services
● Past stints with PostgreSQL family include
○ EnterpriseDB
○ OpenSCG
● Headed Engineering & IT efforts @ IBEX
● Served as Principal Architect/Product Owner @ TRG
Email: haroon@2ndQuadrant.com
: contact.mharoon@gmail.com
Skype: contact.haroon
Where does it all begin ?
Downtime ???
Downtime
● Planned downtime
○ Software maintenance activity (upgrades etc)
○ Hardware maintenance activity (changes, upgrades etc)
● Unplanned downtime
○ Software crash
○ Hardware crash
○ Network failure
○ Human error
Typical DR workflow
Admins/Sysadmins ...
HA - Availability Levels
What is HA after all ?
● RTO - Recovery Time Objective
○ The time interval it will take to restore ...
● RPO - Recovery Point Objective
○ The amount of data that you will lose ...
Admins/Sysadmins ...
RPO
● Backups
○ Logical Backups
■ Database dumps
● SQL script + data
○ Physical backups
■ Online
● Basebackups (provides base for PITR)
■ Offline
● Stop PostgreSQL, take backup
■ Filesystem snapshots
○ WAL archiving
Backup retention ???
PostgreSQL & RTO
PostgreSQL HA - Replication
● Streaming Replication
○ Synchronous
○ Asynchronous
○ Master, slave(s)
○ Master, slave(s), cascaded slaves(s)
● WAL shipping
PostgreSQL HA - Failover Scenario
Primary/Master
Standby 4
Standby 3
Standby 1
App server
Standby 2
PostgreSQL HA - Failover Scenario (cont.)
Primary/Master
Standby 4
Standby 3
Standby 1
App server
Standby 2
PostgreSQL HA - Failover Scenario (cont.)
Old primary/master
Standby 4
Standby 3
Primary/Master
App server
Standby 2
PostgreSQL HA - Failover Scenario (cont.)
Standby 4
Standby 3
Primary/Master
Old primary/master
App server
Standby 2
PostgreSQL HA - Failover Scenario (cont.)
Standby 4
Standby 3
Primary/Master
Standby 1
App server
Standby 2
PostgreSQL HA + Open source PG
community tools + Linux
Free & Open source complete HA
PostgreSQL HA - Streaming Replication
Primary/Master
Standby 4
Standby 3
Standby 1
App server
Proxy
Standby 2
PostgreSQL HA - Streaming Replication
Old Primary/Master
Standby 4
Standby 3
Primary
App server
Proxy
Standby 2
Old primary - STONITH
Shoot
The
Other
Node
In
The
Head
image courtesy ourobengr.com
Further reading
- Barman: http://www.pgbarman.org
- Repmgr: http://www.repmgr.org
- Repmgrd: http://www.repmgr.org
- Pgbouncer: https://pgbouncer.github.io
- pgPool: http://www.pgpool.net/mediawiki/index.php/Main_Page
- pgBackRest: https://github.com/pgbackrest/pgbackrest
- CoroSync: http://corosync.github.io/corosync/
- Various other tools available to work with postgres
Special Thanks!!
Questions
Thank you for your time
Questions ?
● Need customized PostgreSQL suited to your
needs?
● Looking for PostgreSQL training ?
● Need help migrating to PostgreSQL ?
● Need PostgreSQL production support ?
● Got specific PostgreSQL needs ?
● Looking for cloud and/or hybrid high availability
clusters ?
Let us help you!
Email: haroon@2ndQuadrant.com
Skype: contact.haroon
● PostgreSQL News
○ PostgreSQL 9.6 Beta4 Released - August 11, 2016
○ MariaDB license change
○ PGConf.ASIA - Tokyo (2-3 December 2016)
● 2ndQuadrant News
○ repmgr 3.1.5
○ Postgres-XL 9.5 R1.3
○ BDR9.4 1.0
○ 2UDA 9.6 Beta4

More Related Content

PDF
PostgreSQL High Availability in a Containerized World
PDF
PostgreSQL Replication High Availability Methods
PDF
PostgreSQL replication
PPTX
Getting started with postgresql
PDF
PostgreSQL High Availability in a Containerized World
PDF
High Availability PostgreSQL with Zalando Patroni
PPTX
MySQL_MariaDB-성능개선-202201.pptx
PPTX
Mongodb basics and architecture
PostgreSQL High Availability in a Containerized World
PostgreSQL Replication High Availability Methods
PostgreSQL replication
Getting started with postgresql
PostgreSQL High Availability in a Containerized World
High Availability PostgreSQL with Zalando Patroni
MySQL_MariaDB-성능개선-202201.pptx
Mongodb basics and architecture

What's hot (20)

PDF
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
PDF
Introduction to MongoDB
ODP
Introduction to PostgreSQL
PDF
PostgreSQL WAL for DBAs
PDF
Postgresql database administration volume 1
PDF
Introduction to Docker Compose
PDF
MariaDB MaxScale
PDF
Get to know PostgreSQL!
PDF
PostgreSQL Performance Tuning
PDF
Introduction to Google Compute Engine
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
PDF
Mastering PostgreSQL Administration
PDF
What is new in PostgreSQL 14?
ODP
PostgreSQL Administration for System Administrators
PDF
ProxySQL High Avalability and Configuration Management Overview
PPTX
PostgreSQL- An Introduction
PDF
Postgresql tutorial
PDF
M|18 Architectural Overview: MariaDB MaxScale
PDF
MongoDB WiredTiger Internals: Journey To Transactions
PDF
MongoDB WiredTiger Internals
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Introduction to MongoDB
Introduction to PostgreSQL
PostgreSQL WAL for DBAs
Postgresql database administration volume 1
Introduction to Docker Compose
MariaDB MaxScale
Get to know PostgreSQL!
PostgreSQL Performance Tuning
Introduction to Google Compute Engine
How to Manage Scale-Out Environments with MariaDB MaxScale
Mastering PostgreSQL Administration
What is new in PostgreSQL 14?
PostgreSQL Administration for System Administrators
ProxySQL High Avalability and Configuration Management Overview
PostgreSQL- An Introduction
Postgresql tutorial
M|18 Architectural Overview: MariaDB MaxScale
MongoDB WiredTiger Internals: Journey To Transactions
MongoDB WiredTiger Internals
Ad

Viewers also liked (20)

PDF
Built-in Replication in PostgreSQL
PDF
Replication Solutions for PostgreSQL
PPTX
Easy Installation and Setup of PostgreSQL on Linux, OSX, & Windows
PDF
PostgreSQL replication
PDF
Development of 8.3 In India
PDF
PostgreSQL9.0アップデート レプリケーションがやってきた!
PDF
PGDay UK 2016 -- Performace for queries with grouping
PDF
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
PDF
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
PDF
Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
PPTX
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
PDF
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
PDF
Bruce Momjian - Inside PostgreSQL Shared Memory @ Postgres Open
PDF
Keith Paskett - Postgres on ZFS @ Postgres Open
PDF
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
PDF
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
PDF
Islamabad PUG - 7th Meetup - performance tuning
PDF
Out of the box replication in postgres 9.4(pg confus)
PDF
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
PDF
Islamabad PUG - 7th meetup - performance tuning
Built-in Replication in PostgreSQL
Replication Solutions for PostgreSQL
Easy Installation and Setup of PostgreSQL on Linux, OSX, & Windows
PostgreSQL replication
Development of 8.3 In India
PostgreSQL9.0アップデート レプリケーションがやってきた!
PGDay UK 2016 -- Performace for queries with grouping
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
Ryan Jarvinen Open Shift Talk @ Postgres Open 2013
Kevin Kempter - PostgreSQL Backup and Recovery Methods @ Postgres Open
David Keeney - SQL Database Server Requests from the Browser @ Postgres Open
Gurjeet Singh - How Postgres is Different From (Better Tha) Your RDBMS @ Post...
Bruce Momjian - Inside PostgreSQL Shared Memory @ Postgres Open
Keith Paskett - Postgres on ZFS @ Postgres Open
Selena Deckelmann - Sane Schema Management with Alembic and SQLAlchemy @ Pos...
Henrietta Dombrovskaya - A New Approach to Resolve Object-Relational Impedanc...
Islamabad PUG - 7th Meetup - performance tuning
Out of the box replication in postgres 9.4(pg confus)
Robert Haas Query Planning Gone Wrong Presentation @ Postgres Open
Islamabad PUG - 7th meetup - performance tuning
Ad

Similar to PostgreSQL HA (20)

PDF
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
PDF
Hosted PostgreSQL
ODP
Pro PostgreSQL, OSCon 2008
PDF
Big data beyond the JVM - DDTX 2018
PPT
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
PDF
Making the big data ecosystem work together with python apache arrow, spark,...
PDF
Making the big data ecosystem work together with Python & Apache Arrow, Apach...
PDF
An evening with Postgresql
PDF
Are general purpose big data systems eating the world?
PDF
High performance json- postgre sql vs. mongodb
PDF
Elephants in the Cloud
PDF
Accelerating Big Data beyond the JVM - Fosdem 2018
PDF
Useful PostgreSQL Extensions
 
PDF
Screaming Fast Wpmu
PDF
Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
PDF
Powering tensor flow with big data using apache beam, flink, and spark cern...
PDF
Profiling and optimizing go programs
PDF
Debugging PySpark - PyCon US 2018
PDF
Kafka Summit SF 2017 - Streaming Processing in Python – 10 ways to avoid summ...
PDF
Benchmarking for postgresql workloads in kubernetes
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
Hosted PostgreSQL
Pro PostgreSQL, OSCon 2008
Big data beyond the JVM - DDTX 2018
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Making the big data ecosystem work together with python apache arrow, spark,...
Making the big data ecosystem work together with Python & Apache Arrow, Apach...
An evening with Postgresql
Are general purpose big data systems eating the world?
High performance json- postgre sql vs. mongodb
Elephants in the Cloud
Accelerating Big Data beyond the JVM - Fosdem 2018
Useful PostgreSQL Extensions
 
Screaming Fast Wpmu
Whats wrong with postgres | PGConf EU 2019 | Craig Kerstiens
Powering tensor flow with big data using apache beam, flink, and spark cern...
Profiling and optimizing go programs
Debugging PySpark - PyCon US 2018
Kafka Summit SF 2017 - Streaming Processing in Python – 10 ways to avoid summ...
Benchmarking for postgresql workloads in kubernetes

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
KodekX | Application Modernization Development
PDF
NewMind AI Weekly Chronicles - August'25 Week I
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation theory and applications.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PDF
cuic standard and advanced reporting.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
Digital-Transformation-Roadmap-for-Companies.pptx
Empathic Computing: Creating Shared Understanding
Advanced methodologies resolving dimensionality complications for autism neur...
KodekX | Application Modernization Development
NewMind AI Weekly Chronicles - August'25 Week I
The AUB Centre for AI in Media Proposal.docx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Understanding_Digital_Forensics_Presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation theory and applications.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
cuic standard and advanced reporting.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

PostgreSQL HA

  • 1. PostgreSQL - High Availability Muhammad Haroon PUG August 2016, Islamabad
  • 2. Agenda ● A typical workflow in DR ● Why does everyone talk about it ? ● What is HA after all ? ● PostgreSQL HA ● PostgreSQL HA + Linux modus vivendi
  • 3. Who am I ?? ● Working in PostgreSQL space @ 2ndQuadrant ● Part of PostgreSQL family for over 10 years ● Work in almost all areas around PostgreSQL from development to professional services ● Past stints with PostgreSQL family include ○ EnterpriseDB ○ OpenSCG ● Headed Engineering & IT efforts @ IBEX ● Served as Principal Architect/Product Owner @ TRG Email: haroon@2ndQuadrant.com : contact.mharoon@gmail.com Skype: contact.haroon
  • 4. Where does it all begin ?
  • 6. Downtime ● Planned downtime ○ Software maintenance activity (upgrades etc) ○ Hardware maintenance activity (changes, upgrades etc) ● Unplanned downtime ○ Software crash ○ Hardware crash ○ Network failure ○ Human error
  • 10. What is HA after all ? ● RTO - Recovery Time Objective ○ The time interval it will take to restore ... ● RPO - Recovery Point Objective ○ The amount of data that you will lose ...
  • 12. RPO ● Backups ○ Logical Backups ■ Database dumps ● SQL script + data ○ Physical backups ■ Online ● Basebackups (provides base for PITR) ■ Offline ● Stop PostgreSQL, take backup ■ Filesystem snapshots ○ WAL archiving
  • 15. PostgreSQL HA - Replication ● Streaming Replication ○ Synchronous ○ Asynchronous ○ Master, slave(s) ○ Master, slave(s), cascaded slaves(s) ● WAL shipping
  • 16. PostgreSQL HA - Failover Scenario Primary/Master Standby 4 Standby 3 Standby 1 App server Standby 2
  • 17. PostgreSQL HA - Failover Scenario (cont.) Primary/Master Standby 4 Standby 3 Standby 1 App server Standby 2
  • 18. PostgreSQL HA - Failover Scenario (cont.) Old primary/master Standby 4 Standby 3 Primary/Master App server Standby 2
  • 19. PostgreSQL HA - Failover Scenario (cont.) Standby 4 Standby 3 Primary/Master Old primary/master App server Standby 2
  • 20. PostgreSQL HA - Failover Scenario (cont.) Standby 4 Standby 3 Primary/Master Standby 1 App server Standby 2
  • 21. PostgreSQL HA + Open source PG community tools + Linux Free & Open source complete HA
  • 22. PostgreSQL HA - Streaming Replication Primary/Master Standby 4 Standby 3 Standby 1 App server Proxy Standby 2
  • 23. PostgreSQL HA - Streaming Replication Old Primary/Master Standby 4 Standby 3 Primary App server Proxy Standby 2
  • 24. Old primary - STONITH Shoot The Other Node In The Head image courtesy ourobengr.com
  • 25. Further reading - Barman: http://www.pgbarman.org - Repmgr: http://www.repmgr.org - Repmgrd: http://www.repmgr.org - Pgbouncer: https://pgbouncer.github.io - pgPool: http://www.pgpool.net/mediawiki/index.php/Main_Page - pgBackRest: https://github.com/pgbackrest/pgbackrest - CoroSync: http://corosync.github.io/corosync/ - Various other tools available to work with postgres
  • 27. Questions Thank you for your time Questions ? ● Need customized PostgreSQL suited to your needs? ● Looking for PostgreSQL training ? ● Need help migrating to PostgreSQL ? ● Need PostgreSQL production support ? ● Got specific PostgreSQL needs ? ● Looking for cloud and/or hybrid high availability clusters ? Let us help you! Email: haroon@2ndQuadrant.com Skype: contact.haroon
  • 28. ● PostgreSQL News ○ PostgreSQL 9.6 Beta4 Released - August 11, 2016 ○ MariaDB license change ○ PGConf.ASIA - Tokyo (2-3 December 2016) ● 2ndQuadrant News ○ repmgr 3.1.5 ○ Postgres-XL 9.5 R1.3 ○ BDR9.4 1.0 ○ 2UDA 9.6 Beta4