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

Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2
Giuseppe Paterno'
 

What's hot (20)

PostgreSQL and RAM usage
PostgreSQL and RAM usagePostgreSQL and RAM usage
PostgreSQL and RAM usage
 
Oracle Client Failover - Under The Hood
Oracle Client Failover - Under The HoodOracle Client Failover - Under The Hood
Oracle Client Failover - Under The Hood
 
PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs PostgreSQL WAL for DBAs
PostgreSQL WAL for DBAs
 
A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides A Day in the Life of a ClickHouse Query Webinar Slides
A Day in the Life of a ClickHouse Query Webinar Slides
 
Kubernetes networking: Introduction to overlay networks, communication models...
Kubernetes networking: Introduction to overlay networks, communication models...Kubernetes networking: Introduction to overlay networks, communication models...
Kubernetes networking: Introduction to overlay networks, communication models...
 
Google Kubernetes Engine (GKE) deep dive
Google Kubernetes Engine (GKE) deep diveGoogle Kubernetes Engine (GKE) deep dive
Google Kubernetes Engine (GKE) deep dive
 
All about Zookeeper and ClickHouse Keeper.pdf
All about Zookeeper and ClickHouse Keeper.pdfAll about Zookeeper and ClickHouse Keeper.pdf
All about Zookeeper and ClickHouse Keeper.pdf
 
PostgreSql query planning and tuning
PostgreSql query planning and tuningPostgreSql query planning and tuning
PostgreSql query planning and tuning
 
PostgreSQL HA
PostgreSQL   HAPostgreSQL   HA
PostgreSQL HA
 
Ceph and Openstack in a Nutshell
Ceph and Openstack in a NutshellCeph and Openstack in a Nutshell
Ceph and Openstack in a Nutshell
 
Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2Filesystem Comparison: NFS vs GFS2 vs OCFS2
Filesystem Comparison: NFS vs GFS2 vs OCFS2
 
Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드Scouter와 influx db – grafana 연동 가이드
Scouter와 influx db – grafana 연동 가이드
 
Graylog Engineering - Design Your Architecture
Graylog Engineering - Design Your ArchitectureGraylog Engineering - Design Your Architecture
Graylog Engineering - Design Your Architecture
 
Minio Cloud Storage
Minio Cloud StorageMinio Cloud Storage
Minio Cloud Storage
 
NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?NATS Streaming - an alternative to Apache Kafka?
NATS Streaming - an alternative to Apache Kafka?
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEOClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
ClickHouse Query Performance Tips and Tricks, by Robert Hodges, Altinity CEO
 
Apache Airflow
Apache AirflowApache Airflow
Apache Airflow
 
New Generation Oracle RAC Performance
New Generation Oracle RAC PerformanceNew Generation Oracle RAC Performance
New Generation Oracle RAC Performance
 
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UIData Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
Data Warehouses in Kubernetes Visualized: the ClickHouse Kubernetes Operator UI
 

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
 
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
 
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...
 

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

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
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
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Recently uploaded (20)

%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
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
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 

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