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

What's hot (20)

PDF
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
PDF
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
YugabyteDB
 
PDF
PostgreSQL Replication Tutorial
Hans-Jürgen Schönig
 
PDF
High Availability PostgreSQL with Zalando Patroni
Zalando Technology
 
PDF
MyRocks Deep Dive
Yoshinori Matsunobu
 
PDF
Solving PostgreSQL wicked problems
Alexander Korotkov
 
PDF
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
 
PDF
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
 
DOCX
Keepalived+MaxScale+MariaDB_운영매뉴얼_1.0.docx
NeoClova
 
PDF
MariaDB: in-depth (hands on training in Seoul)
Colin Charles
 
PDF
Galera cluster for high availability
Mydbops
 
PDF
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
PostgresOpen
 
PDF
Advanced backup methods (Postgres@CERN)
Anastasia Lubennikova
 
PDF
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
ScaleGrid.io
 
PDF
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
Jean-François Gagné
 
PDF
Spark shuffle introduction
colorant
 
PPTX
Running MariaDB in multiple data centers
MariaDB plc
 
PPTX
Achieving High Availability in PostgreSQL
Mydbops
 
PDF
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
PPTX
MySQL8.0_performance_schema.pptx
NeoClova
 
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
 
Distributed Databases Deconstructed: CockroachDB, TiDB and YugaByte DB
YugabyteDB
 
PostgreSQL Replication Tutorial
Hans-Jürgen Schönig
 
High Availability PostgreSQL with Zalando Patroni
Zalando Technology
 
MyRocks Deep Dive
Yoshinori Matsunobu
 
Solving PostgreSQL wicked problems
Alexander Korotkov
 
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
 
Keepalived+MaxScale+MariaDB_운영매뉴얼_1.0.docx
NeoClova
 
MariaDB: in-depth (hands on training in Seoul)
Colin Charles
 
Galera cluster for high availability
Mydbops
 
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
PostgresOpen
 
Advanced backup methods (Postgres@CERN)
Anastasia Lubennikova
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
ScaleGrid.io
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
Jean-François Gagné
 
Spark shuffle introduction
colorant
 
Running MariaDB in multiple data centers
MariaDB plc
 
Achieving High Availability in PostgreSQL
Mydbops
 
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
MySQL8.0_performance_schema.pptx
NeoClova
 

Viewers also liked (20)

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

Similar to PostgreSQL HA (20)

PPTX
How to Design for Database High Availability
EDB
 
PDF
Creating customized openSUSE versions with SUSE Studio
elliando dias
 
PPTX
High Availability and Disaster Recovery in PostgreSQL - EQUNIX
Julyanto SUTANDANG
 
PDF
Architecture for building scalable and highly available Postgres Cluster
Ashnikbiz
 
PPTX
Automating a PostgreSQL High Availability Architecture with Ansible
EDB
 
PDF
Making your PostgreSQL Database Highly Available
EDB
 
PDF
PGConf.ASIA 2019 - High Availability, 10 Seconds Failover - Lucky Haryadi
Equnix Business Solutions
 
PDF
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
PPTX
Beginner's Guide to High Availability for Postgres
EDB
 
PPTX
Public Sector Virtual Town Hall: High Availability for PostgreSQL
EDB
 
PDF
Beginner's Guide to High Availability for Postgres - French
EDB
 
PPTX
An overview of reference architectures for Postgres
EDB
 
PPTX
An overview of reference architectures for Postgres
EDB
 
PDF
PGConf.ASIA 2019 Bali - Setup a High-Availability and Load Balancing PostgreS...
Equnix Business Solutions
 
PDF
Beginner's Guide to High Availability for Postgres
EDB
 
PPTX
Beginners Guide to High Availability for Postgres
EDB
 
PPTX
Built in physical and logical replication in postgresql-Firat Gulec
FIRAT GULEC
 
PPTX
HA with RelStorage and Postgres
Simone Deponti
 
PDF
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
Aleksander Alekseev
 
PDF
Why we love pgpool-II and why we hate it!
PGConf APAC
 
How to Design for Database High Availability
EDB
 
Creating customized openSUSE versions with SUSE Studio
elliando dias
 
High Availability and Disaster Recovery in PostgreSQL - EQUNIX
Julyanto SUTANDANG
 
Architecture for building scalable and highly available Postgres Cluster
Ashnikbiz
 
Automating a PostgreSQL High Availability Architecture with Ansible
EDB
 
Making your PostgreSQL Database Highly Available
EDB
 
PGConf.ASIA 2019 - High Availability, 10 Seconds Failover - Lucky Haryadi
Equnix Business Solutions
 
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
Beginner's Guide to High Availability for Postgres
EDB
 
Public Sector Virtual Town Hall: High Availability for PostgreSQL
EDB
 
Beginner's Guide to High Availability for Postgres - French
EDB
 
An overview of reference architectures for Postgres
EDB
 
An overview of reference architectures for Postgres
EDB
 
PGConf.ASIA 2019 Bali - Setup a High-Availability and Load Balancing PostgreS...
Equnix Business Solutions
 
Beginner's Guide to High Availability for Postgres
EDB
 
Beginners Guide to High Availability for Postgres
EDB
 
Built in physical and logical replication in postgresql-Firat Gulec
FIRAT GULEC
 
HA with RelStorage and Postgres
Simone Deponti
 
PostgreSQL Sharding and HA: Theory and Practice (PGConf.ASIA 2017)
Aleksander Alekseev
 
Why we love pgpool-II and why we hate it!
PGConf APAC
 
Ad

Recently uploaded (20)

PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
ICONIQ State of AI Report 2025 - The Builder's Playbook
Razin Mustafiz
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 

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: [email protected] : [email protected] 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: [email protected] 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