SlideShare a Scribd company logo
8
Most read
10
Most read
13
Most read
Building Scalable And
Highly Available
Postgres Cluster
Postgres based High Availability Setup with Load Balancing
and no Single Point of Failure
A typical Cluster Setup
• Load Balancing between two or more nodes
• High Availability- If one of the nodes goes down the other
node Takes over the load
• The failover does not involve any configuration changes in
application
PostgreSQL – Worlds Most Advanced Open Source
Database
• Built on top of the same Relational Database Fundamentals that
is basis of all Modern day relational databases e.g. Oracle, DB2,
SQL Server
• Has advanced Streaming Replication features
• Point-in-Time Recovery capabilities
• Multi Version Concurrency control (conceptually similar Oracle’s
undo tablespace concept)
• ANSI-SQL Support
• noSQL datatypes support e.g. JSON, hstore, JSONB
Architectural Overview of PostgreSQL
PostgreSQL – Postgres Plus Users
High Availability Options in Postgres
• OS level (shared-disk) Clustering – e.g. Red Hat Cluster Suite
• A drawback is only one of the nodes is active at a time
• Streaming Replication
• A drawback is that failovers/node promotion is not automated
• The replica can take up read load but the logic to distribute the
read queries has to be built into application
• Next few slides will show some popular architectures we
have seen and limitations which one ideally faces
PostgreSQL Streaming Replication
• WAL (transaction log) based Replication
• Replication can be synchronous or
asynchronous
• Shared nothing architecture
• No network or locking issues for global
shared cache
• No disk contention since each instance
has its own disk
• Can be setup without Archiving of WAL
files
• No disk level mirroring needed
• Standby can accept read queries
Load Balancing with pgpool
• Read query is automatically load
balanced
• pgpool can detect failover and start
sending Read/write to surviving
node
• Node promotion is not automated,
unless pgpool is used for performing
failovers and specific settings of
pgpool are set properly
• No proper safe guarding against
split brain situation
• pgpool becomes a single point of
failure
Automated Failover with EDB Failover Manager
• Automated Failover and Virtual IP
movement makes it easier with 0
configuration changes required at
application end
• Handles the split brain situation
with witness node
• More than 2 nodes can be added
• No load-balancing of read queries
• Failover can be managed by open
source components – e.g. Pacemaker
and Corosync
• Replication always happens using the
Virtual IP which will shift over to the
2nd node upon promotion
• There is a separate Virtual IP used for
application access
• It is suggested to use 3 different LAN –
for pacemaker, replication and
application access
• No Load balancing of read queries
Alternative Open Source Architecture
EDB Failover Manager + pgpool Cluster
• EDB Failover Manager manages the
failover
• pgpool is used for load balancing
• pgpool can be installed on the same
machine as failover manager
witness node
• Still does not solve the problem of
pgpool being a Single Point of
Failure
EDB Failover Manager with pgpool HA
• EDB Failover Manager manages the failover of
database
• pgpool has it own HA which only manages failure
of pgpool
• pgpool also manages a virtual IP which can shift to
2nd pgpool node if there is a failover
• No split brain at pgpool level as at a time only one
node will have virtual IP and hence only one node
will accept connection
• Remember that pgpool is not deciding on DB
failover
• To reduce number of servers, each DB node can
host a pgpool
• but still pgpool will only take care of pgpool failovers
• This means Primary DB and active pgpool can be on two
different servers
• This architecture can be further scaled to work
with more underlying replica/standby DB nodes
3 Node Cluster
• Each of the Servers will have
• Postgres Database Instance
• EDB fm agent
• pgpool
• One the instance is master an replicates to
other two
• EDB fm agents will take care of failover of
databases
• Each of the pgpool is talking with each other via
watchdog
• If pgpool on Primary server goes down the
pgpool on the 2nd server will take over and it
can talk to Master (without changing the role of
Master DB), and 2 standby
• Cons
• A little Complicated to setup (and comprehend)
• Primary DB server has more processes running
and hence one may have performance concerns
• Pros
• Scalable and more nodes can be added
Consideration of Application Clusters
• Today most of the applications have their own clusters for
both High Availability as well as Load Balancing
• 2 or 3 node JBOSS setup which is talking to a single
Database is very common
• Or a DB Cluster (the DB level Cluster is abstracted from
Application Layer)
• With this setup it makes more sense to have a pgpool server
installed on the application server itself so that each
Application server has its own pgpool
pgppol with Application Cluster
• Pros-
• More nodes can be easily
added for both HA as well
as Failover Manager
• Cons-
• One issue in this
architecture is service
level failure of pgpool is
not taken care of
• Failover is managed by Linux-HA
components – Pacemaker and
Corosync
• Replication always happens using the
Virtual IP which will shift over to the
2nd node upon promotion
• pgpool is used for load balancing
• pgpool be installed on a stand-alone
server or on application server or can
be setup as pgpool-HA
• Cluster with more than 2 nodes can
be setup using pacemaker and
corosync
Alternative Open Source Architecture
Benefits of Postgres Cluster
• More stand-by servers can be added and pgpool can be
configured for load balancing across more nodes in runtime
• More stand-by being added can also be added to
synchronous standby list making sure data redundancy is
being maintained on at least one servers
• Standby servers being added can also be added to EDB FM
cluster without bringing down the cluster/switching roles
• Works in tandem with Virtualization and Provisioning on the
fly
Ashnik’s Approach
• To build enterprise class solutions
• Provide an alternative to clustering features which has
created a lock-in for Enterprise Customers
• Consulting services to help customers build architectures
tailored for organization specific requirements
• Consulting and implementation services helping customers
migrate their databases to Postgres without compromising
on Availability and Recoverability of the setup
Architecture for building scalable and highly available Postgres Cluster

More Related Content

What's hot (20)

PPTX
Oracle architecture ppt
Deepak Shetty
 
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
PPTX
NoSQL Architecture Overview
Christopher Foot
 
PPTX
Azure SQL Database & Azure SQL Data Warehouse
Mohamed Tawfik
 
PPTX
MongoDB.pptx
Sigit52
 
PDF
MySQL InnoDB Cluster - Group Replication
Frederic Descamps
 
PDF
MariaDB 10.11 key features overview for DBAs
Federico Razzoli
 
PDF
PostgreSQL replication
NTT DATA OSS Professional Services
 
PDF
Get to know PostgreSQL!
Oddbjørn Steffensen
 
PPTX
Cassandra an overview
PritamKathar
 
PPTX
Introduction to NoSQL
PolarSeven Pty Ltd
 
PDF
MariaDB MaxScale
MariaDB plc
 
PDF
The Oracle RAC Family of Solutions - Presentation
Markus Michalewicz
 
PPTX
MariaDB Galera Cluster
Abdul Manaf
 
PDF
Galera cluster for high availability
Mydbops
 
PDF
Nosql data models
Viet-Trung TRAN
 
PDF
Introduction to docker
Wei-Ting Kuo
 
PPTX
Introduction to azure cosmos db
Ratan Parai
 
PPTX
SQL Server High Availability and Disaster Recovery
Michael Poremba
 
PDF
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 
Oracle architecture ppt
Deepak Shetty
 
How to Manage Scale-Out Environments with MariaDB MaxScale
MariaDB plc
 
NoSQL Architecture Overview
Christopher Foot
 
Azure SQL Database & Azure SQL Data Warehouse
Mohamed Tawfik
 
MongoDB.pptx
Sigit52
 
MySQL InnoDB Cluster - Group Replication
Frederic Descamps
 
MariaDB 10.11 key features overview for DBAs
Federico Razzoli
 
PostgreSQL replication
NTT DATA OSS Professional Services
 
Get to know PostgreSQL!
Oddbjørn Steffensen
 
Cassandra an overview
PritamKathar
 
Introduction to NoSQL
PolarSeven Pty Ltd
 
MariaDB MaxScale
MariaDB plc
 
The Oracle RAC Family of Solutions - Presentation
Markus Michalewicz
 
MariaDB Galera Cluster
Abdul Manaf
 
Galera cluster for high availability
Mydbops
 
Nosql data models
Viet-Trung TRAN
 
Introduction to docker
Wei-Ting Kuo
 
Introduction to azure cosmos db
Ratan Parai
 
SQL Server High Availability and Disaster Recovery
Michael Poremba
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 

Similar to Architecture for building scalable and highly available Postgres Cluster (20)

PDF
(ATS6-PLAT06) Maximizing AEP Performance
BIOVIA
 
PDF
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
PDF
Why we love pgpool-II and why we hate it!
PGConf APAC
 
PPTX
Failover-Apachecon-Asia-2022.pptx
DavidKjerrumgaard1
 
PDF
Webinar Slides: Tungsten Connector / Proxy – The Secret Sauce Behind Zero-Dow...
Continuent
 
PPTX
What's up?
Lars Marius Garshol
 
PDF
Latest (storage IO) patterns for cloud-native applications
OpenEBS
 
PDF
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Jakob Karalus
 
PPTX
Using OpenStack In a Traditional Hosting Environment
OpenStack Foundation
 
PDF
(ATS4-PLAT08) Server Pool Management
BIOVIA
 
PPTX
Capacity Management/Provisioning (Cloud's full, Can't build here)
andyhky
 
PDF
IBM MQ - High Availability and Disaster Recovery
MarkTaylorIBM
 
PPT
Module2 MultiThreads.ppt
shreesha16
 
PDF
Xen and-the-art-of-rails-deployment2640
Newlink
 
PDF
Xen and-the-art-of-rails-deployment2640
Newlink
 
PDF
Xen and-the-art-of-rails-deployment2640
Newlink
 
PDF
Xen and-the-art-of-rails-deployment2640
LLC NewLink
 
PDF
Xen and-the-art-of-rails-deployment2640
Newlink
 
PPTX
Kubernetes at NU.nl (Kubernetes meetup 2019-09-05)
Tibo Beijen
 
PDF
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
BIOVIA
 
(ATS6-PLAT06) Maximizing AEP Performance
BIOVIA
 
PostgreSQL High Availability in a Containerized World
Jignesh Shah
 
Why we love pgpool-II and why we hate it!
PGConf APAC
 
Failover-Apachecon-Asia-2022.pptx
DavidKjerrumgaard1
 
Webinar Slides: Tungsten Connector / Proxy – The Secret Sauce Behind Zero-Dow...
Continuent
 
Latest (storage IO) patterns for cloud-native applications
OpenEBS
 
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Jakob Karalus
 
Using OpenStack In a Traditional Hosting Environment
OpenStack Foundation
 
(ATS4-PLAT08) Server Pool Management
BIOVIA
 
Capacity Management/Provisioning (Cloud's full, Can't build here)
andyhky
 
IBM MQ - High Availability and Disaster Recovery
MarkTaylorIBM
 
Module2 MultiThreads.ppt
shreesha16
 
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
LLC NewLink
 
Xen and-the-art-of-rails-deployment2640
Newlink
 
Kubernetes at NU.nl (Kubernetes meetup 2019-09-05)
Tibo Beijen
 
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
BIOVIA
 
Ad

More from Ashnikbiz (20)

PPTX
CloudOps_tool.pptx
Ashnikbiz
 
PPTX
Webinar_CloudOps final.pptx
Ashnikbiz
 
PPTX
Autoscaling in Kubernetes (K8s)
Ashnikbiz
 
PPTX
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli...
Ashnikbiz
 
PDF
Zero trust in a multi tenant environment
Ashnikbiz
 
PPTX
Deploy and automate ‘Secrets Management’ for a multi-cloud environment
Ashnikbiz
 
PPTX
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
PPTX
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
PPTX
The Best Approach For Multi-cloud Infrastructure Provisioning-2
Ashnikbiz
 
PPTX
The Best Approach For Multi-cloud Infrastructure Provisioning
Ashnikbiz
 
PPTX
Which PostgreSQL is right for your multi cloud strategy? P2
Ashnikbiz
 
PPTX
Which PostgreSQL is right for your multi cloud strategy? P1
Ashnikbiz
 
PPTX
Reduce the complexities of managing Kubernetes clusters anywhere 2
Ashnikbiz
 
PPTX
Reduce the complexities of managing Kubernetes clusters anywhere
Ashnikbiz
 
PPTX
Enhance your multi-cloud application performance using Redis Enterprise P2
Ashnikbiz
 
PPTX
Enhance your multi-cloud application performance using Redis Enterprise P1
Ashnikbiz
 
PPTX
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
PPTX
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
PPTX
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
PPTX
Enterprise-class security with PostgreSQL - 2
Ashnikbiz
 
CloudOps_tool.pptx
Ashnikbiz
 
Webinar_CloudOps final.pptx
Ashnikbiz
 
Autoscaling in Kubernetes (K8s)
Ashnikbiz
 
Why and how to use Kubernetes for scaling of your multi-tier (n-tier) appli...
Ashnikbiz
 
Zero trust in a multi tenant environment
Ashnikbiz
 
Deploy and automate ‘Secrets Management’ for a multi-cloud environment
Ashnikbiz
 
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
Deploy, move and manage Postgres across cloud platforms
Ashnikbiz
 
The Best Approach For Multi-cloud Infrastructure Provisioning-2
Ashnikbiz
 
The Best Approach For Multi-cloud Infrastructure Provisioning
Ashnikbiz
 
Which PostgreSQL is right for your multi cloud strategy? P2
Ashnikbiz
 
Which PostgreSQL is right for your multi cloud strategy? P1
Ashnikbiz
 
Reduce the complexities of managing Kubernetes clusters anywhere 2
Ashnikbiz
 
Reduce the complexities of managing Kubernetes clusters anywhere
Ashnikbiz
 
Enhance your multi-cloud application performance using Redis Enterprise P2
Ashnikbiz
 
Enhance your multi-cloud application performance using Redis Enterprise P1
Ashnikbiz
 
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
Gain multi-cloud versatility with software load balancing designed for cloud-...
Ashnikbiz
 
Enterprise-class security with PostgreSQL - 1
Ashnikbiz
 
Enterprise-class security with PostgreSQL - 2
Ashnikbiz
 
Ad

Recently uploaded (20)

PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PDF
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
PPTX
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
PDF
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PDF
Executive Business Intelligence Dashboards
vandeslie24
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
PDF
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Alarm in Android-Scheduling Timed Tasks Using AlarmManager in Android.pdf
Nabin Dhakal
 
MiniTool Power Data Recovery Full Crack Latest 2025
muhammadgurbazkhan
 
Salesforce CRM Services.VALiNTRY360
VALiNTRY360
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Understanding the Need for Systemic Change in Open Source Through Intersectio...
Imma Valls Bernaus
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Import Data Form Excel to Tally Services
Tally xperts
 
Executive Business Intelligence Dashboards
vandeslie24
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
GridView,Recycler view, API, SQLITE& NetworkRequest.pdf
Nabin Dhakal
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
 

Architecture for building scalable and highly available Postgres Cluster

  • 1. Building Scalable And Highly Available Postgres Cluster Postgres based High Availability Setup with Load Balancing and no Single Point of Failure
  • 2. A typical Cluster Setup • Load Balancing between two or more nodes • High Availability- If one of the nodes goes down the other node Takes over the load • The failover does not involve any configuration changes in application
  • 3. PostgreSQL – Worlds Most Advanced Open Source Database • Built on top of the same Relational Database Fundamentals that is basis of all Modern day relational databases e.g. Oracle, DB2, SQL Server • Has advanced Streaming Replication features • Point-in-Time Recovery capabilities • Multi Version Concurrency control (conceptually similar Oracle’s undo tablespace concept) • ANSI-SQL Support • noSQL datatypes support e.g. JSON, hstore, JSONB
  • 6. High Availability Options in Postgres • OS level (shared-disk) Clustering – e.g. Red Hat Cluster Suite • A drawback is only one of the nodes is active at a time • Streaming Replication • A drawback is that failovers/node promotion is not automated • The replica can take up read load but the logic to distribute the read queries has to be built into application • Next few slides will show some popular architectures we have seen and limitations which one ideally faces
  • 7. PostgreSQL Streaming Replication • WAL (transaction log) based Replication • Replication can be synchronous or asynchronous • Shared nothing architecture • No network or locking issues for global shared cache • No disk contention since each instance has its own disk • Can be setup without Archiving of WAL files • No disk level mirroring needed • Standby can accept read queries
  • 8. Load Balancing with pgpool • Read query is automatically load balanced • pgpool can detect failover and start sending Read/write to surviving node • Node promotion is not automated, unless pgpool is used for performing failovers and specific settings of pgpool are set properly • No proper safe guarding against split brain situation • pgpool becomes a single point of failure
  • 9. Automated Failover with EDB Failover Manager • Automated Failover and Virtual IP movement makes it easier with 0 configuration changes required at application end • Handles the split brain situation with witness node • More than 2 nodes can be added • No load-balancing of read queries
  • 10. • Failover can be managed by open source components – e.g. Pacemaker and Corosync • Replication always happens using the Virtual IP which will shift over to the 2nd node upon promotion • There is a separate Virtual IP used for application access • It is suggested to use 3 different LAN – for pacemaker, replication and application access • No Load balancing of read queries Alternative Open Source Architecture
  • 11. EDB Failover Manager + pgpool Cluster • EDB Failover Manager manages the failover • pgpool is used for load balancing • pgpool can be installed on the same machine as failover manager witness node • Still does not solve the problem of pgpool being a Single Point of Failure
  • 12. EDB Failover Manager with pgpool HA • EDB Failover Manager manages the failover of database • pgpool has it own HA which only manages failure of pgpool • pgpool also manages a virtual IP which can shift to 2nd pgpool node if there is a failover • No split brain at pgpool level as at a time only one node will have virtual IP and hence only one node will accept connection • Remember that pgpool is not deciding on DB failover • To reduce number of servers, each DB node can host a pgpool • but still pgpool will only take care of pgpool failovers • This means Primary DB and active pgpool can be on two different servers • This architecture can be further scaled to work with more underlying replica/standby DB nodes
  • 13. 3 Node Cluster • Each of the Servers will have • Postgres Database Instance • EDB fm agent • pgpool • One the instance is master an replicates to other two • EDB fm agents will take care of failover of databases • Each of the pgpool is talking with each other via watchdog • If pgpool on Primary server goes down the pgpool on the 2nd server will take over and it can talk to Master (without changing the role of Master DB), and 2 standby • Cons • A little Complicated to setup (and comprehend) • Primary DB server has more processes running and hence one may have performance concerns • Pros • Scalable and more nodes can be added
  • 14. Consideration of Application Clusters • Today most of the applications have their own clusters for both High Availability as well as Load Balancing • 2 or 3 node JBOSS setup which is talking to a single Database is very common • Or a DB Cluster (the DB level Cluster is abstracted from Application Layer) • With this setup it makes more sense to have a pgpool server installed on the application server itself so that each Application server has its own pgpool
  • 15. pgppol with Application Cluster • Pros- • More nodes can be easily added for both HA as well as Failover Manager • Cons- • One issue in this architecture is service level failure of pgpool is not taken care of
  • 16. • Failover is managed by Linux-HA components – Pacemaker and Corosync • Replication always happens using the Virtual IP which will shift over to the 2nd node upon promotion • pgpool is used for load balancing • pgpool be installed on a stand-alone server or on application server or can be setup as pgpool-HA • Cluster with more than 2 nodes can be setup using pacemaker and corosync Alternative Open Source Architecture
  • 17. Benefits of Postgres Cluster • More stand-by servers can be added and pgpool can be configured for load balancing across more nodes in runtime • More stand-by being added can also be added to synchronous standby list making sure data redundancy is being maintained on at least one servers • Standby servers being added can also be added to EDB FM cluster without bringing down the cluster/switching roles • Works in tandem with Virtualization and Provisioning on the fly
  • 18. Ashnik’s Approach • To build enterprise class solutions • Provide an alternative to clustering features which has created a lock-in for Enterprise Customers • Consulting services to help customers build architectures tailored for organization specific requirements • Consulting and implementation services helping customers migrate their databases to Postgres without compromising on Availability and Recoverability of the setup