SlideShare a Scribd company logo
1 of 19
Download to read offline
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

How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
PostgreSQL-Consulting
 

What's hot (20)

PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
 
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQLTop 10 Mistakes When Migrating From Oracle to PostgreSQL
Top 10 Mistakes When Migrating From Oracle to PostgreSQL
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackup
 
Postgresql Database Administration Basic - Day1
Postgresql  Database Administration Basic  - Day1Postgresql  Database Administration Basic  - Day1
Postgresql Database Administration Basic - Day1
 
PostgreSQL High Availability in a Containerized World
PostgreSQL High Availability in a Containerized WorldPostgreSQL High Availability in a Containerized World
PostgreSQL High Availability in a Containerized World
 
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
 
Patroni - HA PostgreSQL made easy
Patroni - HA PostgreSQL made easyPatroni - HA PostgreSQL made easy
Patroni - HA PostgreSQL made easy
 
PostgreSQL on Kubernetes: Realizing High Availability with PGO (Postgres Ibiz...
PostgreSQL on Kubernetes: Realizing High Availability with PGO (Postgres Ibiz...PostgreSQL on Kubernetes: Realizing High Availability with PGO (Postgres Ibiz...
PostgreSQL on Kubernetes: Realizing High Availability with PGO (Postgres Ibiz...
 
tow nodes Oracle 12c RAC on virtualbox
tow nodes Oracle 12c RAC on virtualboxtow nodes Oracle 12c RAC on virtualbox
tow nodes Oracle 12c RAC on virtualbox
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
How does PostgreSQL work with disks: a DBA's checklist in detail. PGConf.US 2015
 
PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage
 
Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databases
 
PostgreSQLのfull_page_writesについて(第24回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQLのfull_page_writesについて(第24回PostgreSQLアンカンファレンス@オンライン 発表資料)PostgreSQLのfull_page_writesについて(第24回PostgreSQLアンカンファレンス@オンライン 発表資料)
PostgreSQLのfull_page_writesについて(第24回PostgreSQLアンカンファレンス@オンライン 発表資料)
 
Your first ClickHouse data warehouse
Your first ClickHouse data warehouseYour first ClickHouse data warehouse
Your first ClickHouse data warehouse
 
How to upgrade like a boss to my sql 8.0?
How to upgrade like a boss to my sql 8.0?How to upgrade like a boss to my sql 8.0?
How to upgrade like a boss to my sql 8.0?
 
InnoDb Vs NDB Cluster
InnoDb Vs NDB ClusterInnoDb Vs NDB Cluster
InnoDb Vs NDB Cluster
 
Enterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIEnterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLI
 
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdf
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdfOracle_Multitenant_19c_-_All_About_Pluggable_D.pdf
Oracle_Multitenant_19c_-_All_About_Pluggable_D.pdf
 

Similar to Architecture for building scalable and highly available Postgres Cluster

Using OpenStack In a Traditional Hosting Environment
Using OpenStack In a Traditional Hosting EnvironmentUsing OpenStack In a Traditional Hosting Environment
Using OpenStack In a Traditional Hosting Environment
OpenStack Foundation
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.ppt
shreesha16
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
LLC NewLink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
Newlink
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
Newlink
 

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

(ATS6-PLAT06) Maximizing AEP Performance
(ATS6-PLAT06) Maximizing AEP Performance(ATS6-PLAT06) Maximizing AEP Performance
(ATS6-PLAT06) Maximizing AEP Performance
 
Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!
 
Failover-Apachecon-Asia-2022.pptx
Failover-Apachecon-Asia-2022.pptxFailover-Apachecon-Asia-2022.pptx
Failover-Apachecon-Asia-2022.pptx
 
Webinar Slides: Tungsten Connector / Proxy – The Secret Sauce Behind Zero-Dow...
Webinar Slides: Tungsten Connector / Proxy – The Secret Sauce Behind Zero-Dow...Webinar Slides: Tungsten Connector / Proxy – The Secret Sauce Behind Zero-Dow...
Webinar Slides: Tungsten Connector / Proxy – The Secret Sauce Behind Zero-Dow...
 
What's up?
What's up?What's up?
What's up?
 
Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications
 
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob KaralusDistributed Tensorflow with Kubernetes - data2day - Jakob Karalus
Distributed Tensorflow with Kubernetes - data2day - Jakob Karalus
 
Using OpenStack In a Traditional Hosting Environment
Using OpenStack In a Traditional Hosting EnvironmentUsing OpenStack In a Traditional Hosting Environment
Using OpenStack In a Traditional Hosting Environment
 
(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management(ATS4-PLAT08) Server Pool Management
(ATS4-PLAT08) Server Pool Management
 
Capacity Management/Provisioning (Cloud's full, Can't build here)
Capacity Management/Provisioning (Cloud's full, Can't build here)Capacity Management/Provisioning (Cloud's full, Can't build here)
Capacity Management/Provisioning (Cloud's full, Can't build here)
 
IBM MQ - High Availability and Disaster Recovery
IBM MQ - High Availability and Disaster RecoveryIBM MQ - High Availability and Disaster Recovery
IBM MQ - High Availability and Disaster Recovery
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.ppt
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640Xen and-the-art-of-rails-deployment2640
Xen and-the-art-of-rails-deployment2640
 
Kubernetes at NU.nl (Kubernetes meetup 2019-09-05)
Kubernetes at NU.nl   (Kubernetes meetup 2019-09-05)Kubernetes at NU.nl   (Kubernetes meetup 2019-09-05)
Kubernetes at NU.nl (Kubernetes meetup 2019-09-05)
 
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
(ATS4-PLAT01) Core Architecture Changes in AEP 9.0 and their Impact on Admini...
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 

More from Ashnikbiz

More from Ashnikbiz (20)

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

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Recently uploaded (20)

How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 

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