SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Deploying Maximum
      HA architecture
       with
    PostgreSQL



 /           Denish Patel
           Database Architect
Who am I ?
   • Denish Patel
   •   Database Architect with OmniTI for more than 5 years

   •   Expertise in PostgreSQL , Oracle, MySQL, MS SQL Server

   •   Contact : denish@omniti.com

   •   Blog: http://denishjpatel.blogspot.com/

   •   Providing Solutions for business problems to deliver

       •   Scalability

       •   Reliability

       •   High Availability               We are hiring!!
       •   Consistency
                                          Apply @ l42.org/lg
       •   Security
                                 1
Agendum




   •   Why do you need HA architecture ?
   •   Why PostgreSQL ?
   •   Traditional HA Architecture
   •   Goals for Maximum HA
   •   Maximum HA Solution




                          2
Assumptions




    •   Consistency and Availability Matters (CAP
        theorem)
    •   Good to reduce MTTF but you have “real”
        control on MTTR.




                           3
Why do you need HA architecture?



        Application               Unavailability of
        Downtime                      Data




     Loss of productivity
     Loss of Revenue
     Dissatisfied Customers


                              4
Why do you need HA architecture?

                     System
  Unplanned          Failures
   Outages
                      Data           Prevent
                     Failures
                                     Tolerate
                     System        Recover Fast
  Planned            Changes
  Outages
                      Data
                     Changes
                       5
Why PostreSQL ?




    •   Best protection at Lowest Cost
    •   No additional software costs for providing maximum
        Availability compared to closed source databases
    •   Provide free feature sets to prevent outages, tolerate
        them and recover fast.




                               6
Traditional HA Architecture

       Master                  Standby Database
      Database




                    Copy WAL
                      files

      WAL                            WAL
                  PostgreSQL
                       8
                         7
Traditional HA Architecture
        Master                     Hot Standby
       Database                     Database


                     Steaming
                     Replication




                    Copy WAL
                      files

       WAL                            WAL
                  PostgreSQL
                       9
                           8
Goals for Maximum HA Architecture




    •   99.99% Uptime of application
    •   Reduce MTTR
        •   Planned outages
        •   Unplanned outages




                          9
Plan to reduce MTTR
    •   How do you manage failover ?

        •   Is it transparent to your application?

    •   Hot Backups/ Dumps

        •   Are you running on production server?

    •   Schema backups

        •   How often? Are they under revision control ?

    •   WAL files copy scripts

        •   Do all of your prod servers using same copy of the
            script ?

    •   Where is your reporting queries pointing to ?

        •   Production DB?
                                 10
System Failures
                             Server Node Fails




                               Storage Fails
                  System
                  Failures
                                 Site Fails




 Unplanned
  Outages

                  11
Handle System Failures

           inet


                         Floating IP/ VIP


   App
  Server
                  Master

                                      Failover

                         12
Site Failures
                           Server Node Fails




                             Storage Fails
                System
                Failures
                               Site Fails




 Unplanned
  Outages

                13
Handle Site Failures

                                                 Offsite Bkp
           inet


                       Floating IP/        WAL
                           VIP             apply
   App
  Server
                                             Ship WAL Files
                   Master
                                      Failover

                             SRHS
                            14
Data Failures

Unplanned
 Outages

                            Human Error




                 Data
                Failures
                           Data Corruption



                 15
Handle Data Failures


    •   PITR slave lag using OMNIpitr
        •   1 hour lag on wal apply
    •   Periodic pg_dump tables from slave
    •   Run pg_extractor
        •   https://github.com/omniti-
            labs/pg_extractor
        •   Track schema changes into subversion/git




                             16
Data Corruption


Unplanned
 Outages

                              Human Error




                   Data
                  Failures
                             Data Corruption



                   17
Handle Data Corruption


    • File System level backups
      • Backups on Slave database using
        OMNIpitr
      • Regular recovery testing
      • Snapshot backups for faster recovery
        • Solaris ZFS is recommended!
    • Monthly pg_dump backups
      • Backups on slave
                         18
System Changes
                             OS Upgrade




                           Database Upgrade
                 System
                 Changes
                           Network Changes




  Planned
  Outages

                 19
Handle OS Upgrades
                     Floating IP
                       Master

          SRHS

                           Master
                                    SRHS

                                       Failover
     Read        WAL
    Slave 1      Copy

                      NAS


                           20
Handle OS Upgrades
                     Floating IP
                       Master
                                     Upgrade OS
          SRHS

                           Master
                                    SRHS

                                        New
     Read        WAL
                                       Master
    Slave 1      Copy

                      NAS


                           21
Handle OS Upgrades
                     Floating IP
                       Master

          SRHS

                           New
                                     SRHS
                          Failover

                                         New
     Read        WAL
                                        Master
    Slave 1      Copy

                      NAS


                           22
System Changes
                             OS Upgrade




                           Database Upgrade
                 System
                 Changes
                           Network Changes




  Planned
  Outages

                 23
Handle Database Upgrade
                                                      Yes
        No                    PG 8.3+ ?                         Outage
                                                              acceptable
                                                                  ?
           Outage                                                        No
         acceptable?
                                              Yes
                                                             pg_upgrad
  No                       Yes                                e –check
                                                                pass?
    Third
                                                Yes
  party Rep            pg_dump                                           No
  i.e Slony            pg_restore
                                                            Drop incompatible
                                                              tables before
                                                               upgrade and
                                         pg_upgrade            restore after
 * Only showing recommended
            options
                                    24
Handle Data Changes

 Planned
 Outages

                                Alter Schemas




                       Data
                      Changes
                                Data growth



                       25
Handle Alter schemas


    •   Transactional DDL
    •   CREATE or REPLACE views
    •   NOT VALID
        •   Checks
        •   FKs
    •   Add column without scanning entire table
        •   NULLABLE
        •   No Default


                            26
Handle Data Changes

 Planned
 Outages

                                Alter Schemas




                       Data
                      Changes
                                Data growth




                       27
Handle Data Growth

        PostgreSQL Bloat removal
        •   Offline
            •   VACUUM FULL
            •   CLUSTER
        •   Online
            •   Rebuild index CONCURRENTLY
            •   Rebuild table online using pg_reorg



http://denishjpatel.blogspot.com/2011/03/extreme-training-session-at-pgeast-p90x.html


                                         28
Now we have ….



           9
                          PITR

   Floating IP
                          pg_extractor


          pg_reorg
                     29
Maximum HA Architecture

App                   Floating IP
                        Master
          LB                         SRHS          Bkp

                                        Failover
                            Master
               SRHS

 Read                                             WAL
Slave 2                                           apply
                         NAS
       Read
                                            Bkp
      Salve 1
                              30
References

    • PostgreSQL Documentations
     • http://www.postgresql.org/docs/
    • OmniTI Labs
     • https://labs.omniti.com/
       • OMNIpitr
       • pg_extractor

                   30
Thanks




    • PG Day NYC Conference Committee
    • OmniTI
    • You!!



                     31
Questions?




             32

Weitere ähnliche Inhalte

Was ist angesagt?

SUSE Expert Days 2017 FUJITSU
SUSE Expert Days 2017 FUJITSUSUSE Expert Days 2017 FUJITSU
SUSE Expert Days 2017 FUJITSUSUSE España
 
End of RAID as we know it with Ceph Replication
End of RAID as we know it with Ceph ReplicationEnd of RAID as we know it with Ceph Replication
End of RAID as we know it with Ceph ReplicationCeph Community
 
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...VMworld
 
CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012
CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012
CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012Amazon Web Services
 
Wicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
Wicked Easy Ceph Block Storage & OpenStack Deployment with CrowbarWicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
Wicked Easy Ceph Block Storage & OpenStack Deployment with CrowbarKamesh Pemmaraju
 
Oracle Database Appliance RAC in a box Some Strings Attached
Oracle Database Appliance RAC in a box Some Strings AttachedOracle Database Appliance RAC in a box Some Strings Attached
Oracle Database Appliance RAC in a box Some Strings AttachedFuad Arshad
 
Inter connect2016 yps-2749_02232016_aspresented
Inter connect2016 yps-2749_02232016_aspresentedInter connect2016 yps-2749_02232016_aspresented
Inter connect2016 yps-2749_02232016_aspresentedBruce Semple
 
8 christian ferber xen_server_6_news
8 christian ferber xen_server_6_news8 christian ferber xen_server_6_news
8 christian ferber xen_server_6_newsDigicomp Academy AG
 
VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...
VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...
VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...NetApp
 
SUSE Expert Days 2017 LENOVO
SUSE Expert Days 2017 LENOVOSUSE Expert Days 2017 LENOVO
SUSE Expert Days 2017 LENOVOSUSE España
 
Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...
Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...
Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...Lindsey Aitchison
 
Accelerating Server Hardware Upgrades with PlateSpin Migrate P2P
Accelerating Server Hardware Upgrades with PlateSpin Migrate P2PAccelerating Server Hardware Upgrades with PlateSpin Migrate P2P
Accelerating Server Hardware Upgrades with PlateSpin Migrate P2PNovell
 
SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...
SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...
SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...Michael Noel
 
SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012
SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012
SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012Michael Noel
 
Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance
Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance
Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance Ceph Community
 

Was ist angesagt? (20)

SUSE Expert Days 2017 FUJITSU
SUSE Expert Days 2017 FUJITSUSUSE Expert Days 2017 FUJITSU
SUSE Expert Days 2017 FUJITSU
 
End of RAID as we know it with Ceph Replication
End of RAID as we know it with Ceph ReplicationEnd of RAID as we know it with Ceph Replication
End of RAID as we know it with Ceph Replication
 
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
VMworld Europe 2014: Advanced SQL Server on vSphere Techniques and Best Pract...
 
Delphix
DelphixDelphix
Delphix
 
CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012
CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012
CPN208 Failures at Scale & How to Ride Through Them - AWS re: Invent 2012
 
dbaas-clone
dbaas-clonedbaas-clone
dbaas-clone
 
Wicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
Wicked Easy Ceph Block Storage & OpenStack Deployment with CrowbarWicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
Wicked Easy Ceph Block Storage & OpenStack Deployment with Crowbar
 
Oracle Database Appliance RAC in a box Some Strings Attached
Oracle Database Appliance RAC in a box Some Strings AttachedOracle Database Appliance RAC in a box Some Strings Attached
Oracle Database Appliance RAC in a box Some Strings Attached
 
Inter connect2016 yps-2749_02232016_aspresented
Inter connect2016 yps-2749_02232016_aspresentedInter connect2016 yps-2749_02232016_aspresented
Inter connect2016 yps-2749_02232016_aspresented
 
8 christian ferber xen_server_6_news
8 christian ferber xen_server_6_news8 christian ferber xen_server_6_news
8 christian ferber xen_server_6_news
 
VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...
VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...
VMware PEX Boot Camp - The Future Now: NetApp Clustered Storage and Flash for...
 
SUSE Expert Days 2017 LENOVO
SUSE Expert Days 2017 LENOVOSUSE Expert Days 2017 LENOVO
SUSE Expert Days 2017 LENOVO
 
Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...
Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...
Building an Oracle Grid with Oracle VM on Dell Blade Servers and EqualLogic i...
 
Accelerating Server Hardware Upgrades with PlateSpin Migrate P2P
Accelerating Server Hardware Upgrades with PlateSpin Migrate P2PAccelerating Server Hardware Upgrades with PlateSpin Migrate P2P
Accelerating Server Hardware Upgrades with PlateSpin Migrate P2P
 
SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...
SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...
SQL 2012 AlwaysOn Availability Groups (AOAGs) for SharePoint Farms - Norcall ...
 
SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012
SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012
SQL 2012 AlwaysOn Availability Groups for SharePoint 2010 - AUSPC2012
 
27ian2011 hp
27ian2011   hp27ian2011   hp
27ian2011 hp
 
TechTalkThai-CiscoHyperFlex
TechTalkThai-CiscoHyperFlexTechTalkThai-CiscoHyperFlex
TechTalkThai-CiscoHyperFlex
 
Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance
Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance
Ceph Day Shanghai - SSD/NVM Technology Boosting Ceph Performance
 
Puppet on a string
Puppet on a stringPuppet on a string
Puppet on a string
 

Andere mochten auch

PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLReactive.IO
 
Scaling PostreSQL with Stado
Scaling PostreSQL with StadoScaling PostreSQL with Stado
Scaling PostreSQL with StadoJim Mlodgenski
 
Greatdebate Postgres vs Mysql
Greatdebate Postgres vs MysqlGreatdebate Postgres vs Mysql
Greatdebate Postgres vs MysqlKrishna Infosoft
 
Debugging Your PL/pgSQL Code
Debugging Your PL/pgSQL CodeDebugging Your PL/pgSQL Code
Debugging Your PL/pgSQL CodeJim Mlodgenski
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasJim Mlodgenski
 
Materialized views in PostgreSQL
Materialized views in PostgreSQLMaterialized views in PostgreSQL
Materialized views in PostgreSQLAshutosh Bapat
 
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle Ashnikbiz
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQLVu Hung Nguyen
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersJim Mlodgenski
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQLJim Mlodgenski
 
PostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major FeaturesPostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major FeaturesInMobi Technology
 
Managing a 14 TB reporting datawarehouse with postgresql
Managing a 14 TB reporting datawarehouse with postgresql Managing a 14 TB reporting datawarehouse with postgresql
Managing a 14 TB reporting datawarehouse with postgresql Soumya Ranjan Subudhi
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Denish Patel
 

Andere mochten auch (20)

PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQLPL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
PL/pgSQL - An Introduction on Using Imperative Programming in PostgreSQL
 
Scaling PostreSQL with Stado
Scaling PostreSQL with StadoScaling PostreSQL with Stado
Scaling PostreSQL with Stado
 
Greatdebate Postgres vs Mysql
Greatdebate Postgres vs MysqlGreatdebate Postgres vs Mysql
Greatdebate Postgres vs Mysql
 
Profiling PL/pgSQL
Profiling PL/pgSQLProfiling PL/pgSQL
Profiling PL/pgSQL
 
Debugging Your PL/pgSQL Code
Debugging Your PL/pgSQL CodeDebugging Your PL/pgSQL Code
Debugging Your PL/pgSQL Code
 
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and GotchasPostgreSQL Procedural Languages: Tips, Tricks and Gotchas
PostgreSQL Procedural Languages: Tips, Tricks and Gotchas
 
Postgresql Federation
Postgresql FederationPostgresql Federation
Postgresql Federation
 
Materialized views in PostgreSQL
Materialized views in PostgreSQLMaterialized views in PostgreSQL
Materialized views in PostgreSQL
 
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQL
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL Triggers
 
Introduction to PostgreSQL
Introduction to PostgreSQLIntroduction to PostgreSQL
Introduction to PostgreSQL
 
PostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major FeaturesPostgreSQL 9.5 - Major Features
PostgreSQL 9.5 - Major Features
 
Managing a 14 TB reporting datawarehouse with postgresql
Managing a 14 TB reporting datawarehouse with postgresql Managing a 14 TB reporting datawarehouse with postgresql
Managing a 14 TB reporting datawarehouse with postgresql
 
Why use PostgreSQL?
Why use PostgreSQL?Why use PostgreSQL?
Why use PostgreSQL?
 
PostgreSQL Replication Tutorial
PostgreSQL Replication TutorialPostgreSQL Replication Tutorial
PostgreSQL Replication Tutorial
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Get to know PostgreSQL!
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!
 
PostgreSQL and MySQL
PostgreSQL and MySQLPostgreSQL and MySQL
PostgreSQL and MySQL
 
Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4Out of the box replication in postgres 9.4
Out of the box replication in postgres 9.4
 

Ähnlich wie Deploying Maximum HA Architecture With PostgreSQL

Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDenish Patel
 
Best Practices for Virtualizing Hadoop
Best Practices for Virtualizing HadoopBest Practices for Virtualizing Hadoop
Best Practices for Virtualizing HadoopDataWorks Summit
 
NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012Michael Harding
 
Virtualizing Latency Sensitive Workloads and vFabric GemFire
Virtualizing Latency Sensitive Workloads and vFabric GemFireVirtualizing Latency Sensitive Workloads and vFabric GemFire
Virtualizing Latency Sensitive Workloads and vFabric GemFireCarter Shanklin
 
2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision2.Oracle’S High Availability Vision
2.Oracle’S High Availability VisionErmando
 
Hadoop World 2011: Hadoop as a Service in Cloud
Hadoop World 2011: Hadoop as a Service in CloudHadoop World 2011: Hadoop as a Service in Cloud
Hadoop World 2011: Hadoop as a Service in CloudCloudera, Inc.
 
Yahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsYahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsConSanFrancisco123
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsJignesh Shah
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008mwlang88
 
Mitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel Kannel
Mitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel KannelMitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel Kannel
Mitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel KannelORACLE USER GROUP ESTONIA
 
App cap2956v2-121001194956-phpapp01 (1)
App cap2956v2-121001194956-phpapp01 (1)App cap2956v2-121001194956-phpapp01 (1)
App cap2956v2-121001194956-phpapp01 (1)outstanding59
 
Inside the Hadoop Machine @ VMworld
Inside the Hadoop Machine @ VMworldInside the Hadoop Machine @ VMworld
Inside the Hadoop Machine @ VMworldRichard McDougall
 
App Cap2956v2 121001194956 Phpapp01 (1)
App Cap2956v2 121001194956 Phpapp01 (1)App Cap2956v2 121001194956 Phpapp01 (1)
App Cap2956v2 121001194956 Phpapp01 (1)outstanding59
 
Architecting the Future of Big Data & Search - Eric Baldeschwieler
Architecting the Future of Big Data & Search - Eric BaldeschwielerArchitecting the Future of Big Data & Search - Eric Baldeschwieler
Architecting the Future of Big Data & Search - Eric Baldeschwielerlucenerevolution
 
Deliver Big Data, Database and AI/ML as-a-Service anywhere
Deliver Big Data, Database and AI/ML as-a-Service anywhereDeliver Big Data, Database and AI/ML as-a-Service anywhere
Deliver Big Data, Database and AI/ML as-a-Service anywhereRavikumar Alluboyina
 
Systems Design Experiences or Just Some War Stories…
Systems Design Experiences or Just Some War Stories…Systems Design Experiences or Just Some War Stories…
Systems Design Experiences or Just Some War Stories…Persistent Systems Ltd.
 
Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011
Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011
Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011Cloudera, Inc.
 
Severalnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines
 

Ähnlich wie Deploying Maximum HA Architecture With PostgreSQL (20)

Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQL
 
Best Practices for Virtualizing Hadoop
Best Practices for Virtualizing HadoopBest Practices for Virtualizing Hadoop
Best Practices for Virtualizing Hadoop
 
NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012
 
Oow Ppt 2
Oow Ppt 2Oow Ppt 2
Oow Ppt 2
 
Virtualizing Latency Sensitive Workloads and vFabric GemFire
Virtualizing Latency Sensitive Workloads and vFabric GemFireVirtualizing Latency Sensitive Workloads and vFabric GemFire
Virtualizing Latency Sensitive Workloads and vFabric GemFire
 
2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision2.Oracle’S High Availability Vision
2.Oracle’S High Availability Vision
 
Hadoop World 2011: Hadoop as a Service in Cloud
Hadoop World 2011: Hadoop as a Service in CloudHadoop World 2011: Hadoop as a Service in Cloud
Hadoop World 2011: Hadoop as a Service in Cloud
 
Hadoop on VMware
Hadoop on VMwareHadoop on VMware
Hadoop on VMware
 
Yahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsYahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely Bedfellows
 
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized EnvironmentsBest Practices of HA and Replication of PostgreSQL in Virtualized Environments
Best Practices of HA and Replication of PostgreSQL in Virtualized Environments
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008
 
Mitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel Kannel
Mitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel KannelMitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel Kannel
Mitmepalgeline uus protsessor T4 SUN´i perekonnast - Karel Kannel
 
App cap2956v2-121001194956-phpapp01 (1)
App cap2956v2-121001194956-phpapp01 (1)App cap2956v2-121001194956-phpapp01 (1)
App cap2956v2-121001194956-phpapp01 (1)
 
Inside the Hadoop Machine @ VMworld
Inside the Hadoop Machine @ VMworldInside the Hadoop Machine @ VMworld
Inside the Hadoop Machine @ VMworld
 
App Cap2956v2 121001194956 Phpapp01 (1)
App Cap2956v2 121001194956 Phpapp01 (1)App Cap2956v2 121001194956 Phpapp01 (1)
App Cap2956v2 121001194956 Phpapp01 (1)
 
Architecting the Future of Big Data & Search - Eric Baldeschwieler
Architecting the Future of Big Data & Search - Eric BaldeschwielerArchitecting the Future of Big Data & Search - Eric Baldeschwieler
Architecting the Future of Big Data & Search - Eric Baldeschwieler
 
Deliver Big Data, Database and AI/ML as-a-Service anywhere
Deliver Big Data, Database and AI/ML as-a-Service anywhereDeliver Big Data, Database and AI/ML as-a-Service anywhere
Deliver Big Data, Database and AI/ML as-a-Service anywhere
 
Systems Design Experiences or Just Some War Stories…
Systems Design Experiences or Just Some War Stories…Systems Design Experiences or Just Some War Stories…
Systems Design Experiences or Just Some War Stories…
 
Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011
Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011
Hadoop in the Enterprise - Dr. Amr Awadallah @ Microstrategy World 2011
 
Severalnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IX
 

Mehr von Denish Patel

Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres MonitoringDenish Patel
 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Denish Patel
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Denish Patel
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Denish Patel
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Denish Patel
 
Postgres in Amazon RDS
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDSDenish Patel
 
Choosing the "D" , Lightning talk
Choosing the "D" , Lightning talkChoosing the "D" , Lightning talk
Choosing the "D" , Lightning talkDenish Patel
 
Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2 Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2 Denish Patel
 
Two Elephants Inthe Room
Two Elephants Inthe RoomTwo Elephants Inthe Room
Two Elephants Inthe RoomDenish Patel
 
P90 X Your Database!!
P90 X Your Database!!P90 X Your Database!!
P90 X Your Database!!Denish Patel
 
Achieving Pci Compliace
Achieving Pci CompliaceAchieving Pci Compliace
Achieving Pci CompliaceDenish Patel
 
Using SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionUsing SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionDenish Patel
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features IDenish Patel
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepDenish Patel
 

Mehr von Denish Patel (15)

Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
 
Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)Out of the Box Replication in Postgres 9.4(PgConfUS)
Out of the Box Replication in Postgres 9.4(PgConfUS)
 
Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)Out of the box replication in postgres 9.4(pg confus)
Out of the box replication in postgres 9.4(pg confus)
 
Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)Out of the Box Replication in Postgres 9.4(pgconfsf)
Out of the Box Replication in Postgres 9.4(pgconfsf)
 
Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)Out of the Box Replication in Postgres 9.4(PgCon)
Out of the Box Replication in Postgres 9.4(PgCon)
 
Postgres in Amazon RDS
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDS
 
Choosing the "D" , Lightning talk
Choosing the "D" , Lightning talkChoosing the "D" , Lightning talk
Choosing the "D" , Lightning talk
 
Scaling postgres
Scaling postgresScaling postgres
Scaling postgres
 
Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2 Deploying postgre sql on amazon ec2
Deploying postgre sql on amazon ec2
 
Two Elephants Inthe Room
Two Elephants Inthe RoomTwo Elephants Inthe Room
Two Elephants Inthe Room
 
P90 X Your Database!!
P90 X Your Database!!P90 X Your Database!!
P90 X Your Database!!
 
Achieving Pci Compliace
Achieving Pci CompliaceAchieving Pci Compliace
Achieving Pci Compliace
 
Using SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionUsing SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparition
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRep
 

Deploying Maximum HA Architecture With PostgreSQL

  • 1. Deploying Maximum HA architecture with PostgreSQL / Denish Patel Database Architect
  • 2. Who am I ? • Denish Patel • Database Architect with OmniTI for more than 5 years • Expertise in PostgreSQL , Oracle, MySQL, MS SQL Server • Contact : denish@omniti.com • Blog: http://denishjpatel.blogspot.com/ • Providing Solutions for business problems to deliver • Scalability • Reliability • High Availability We are hiring!! • Consistency Apply @ l42.org/lg • Security 1
  • 3. Agendum • Why do you need HA architecture ? • Why PostgreSQL ? • Traditional HA Architecture • Goals for Maximum HA • Maximum HA Solution 2
  • 4. Assumptions • Consistency and Availability Matters (CAP theorem) • Good to reduce MTTF but you have “real” control on MTTR. 3
  • 5. Why do you need HA architecture? Application Unavailability of Downtime Data Loss of productivity Loss of Revenue Dissatisfied Customers 4
  • 6. Why do you need HA architecture? System Unplanned Failures Outages Data Prevent Failures Tolerate System Recover Fast Planned Changes Outages Data Changes 5
  • 7. Why PostreSQL ? • Best protection at Lowest Cost • No additional software costs for providing maximum Availability compared to closed source databases • Provide free feature sets to prevent outages, tolerate them and recover fast. 6
  • 8. Traditional HA Architecture Master Standby Database Database Copy WAL files WAL WAL PostgreSQL 8 7
  • 9. Traditional HA Architecture Master Hot Standby Database Database Steaming Replication Copy WAL files WAL WAL PostgreSQL 9 8
  • 10. Goals for Maximum HA Architecture • 99.99% Uptime of application • Reduce MTTR • Planned outages • Unplanned outages 9
  • 11. Plan to reduce MTTR • How do you manage failover ? • Is it transparent to your application? • Hot Backups/ Dumps • Are you running on production server? • Schema backups • How often? Are they under revision control ? • WAL files copy scripts • Do all of your prod servers using same copy of the script ? • Where is your reporting queries pointing to ? • Production DB? 10
  • 12. System Failures Server Node Fails Storage Fails System Failures Site Fails Unplanned Outages 11
  • 13. Handle System Failures inet Floating IP/ VIP App Server Master Failover 12
  • 14. Site Failures Server Node Fails Storage Fails System Failures Site Fails Unplanned Outages 13
  • 15. Handle Site Failures Offsite Bkp inet Floating IP/ WAL VIP apply App Server Ship WAL Files Master Failover SRHS 14
  • 16. Data Failures Unplanned Outages Human Error Data Failures Data Corruption 15
  • 17. Handle Data Failures • PITR slave lag using OMNIpitr • 1 hour lag on wal apply • Periodic pg_dump tables from slave • Run pg_extractor • https://github.com/omniti- labs/pg_extractor • Track schema changes into subversion/git 16
  • 18. Data Corruption Unplanned Outages Human Error Data Failures Data Corruption 17
  • 19. Handle Data Corruption • File System level backups • Backups on Slave database using OMNIpitr • Regular recovery testing • Snapshot backups for faster recovery • Solaris ZFS is recommended! • Monthly pg_dump backups • Backups on slave 18
  • 20. System Changes OS Upgrade Database Upgrade System Changes Network Changes Planned Outages 19
  • 21. Handle OS Upgrades Floating IP Master SRHS Master SRHS Failover Read WAL Slave 1 Copy NAS 20
  • 22. Handle OS Upgrades Floating IP Master Upgrade OS SRHS Master SRHS New Read WAL Master Slave 1 Copy NAS 21
  • 23. Handle OS Upgrades Floating IP Master SRHS New SRHS Failover New Read WAL Master Slave 1 Copy NAS 22
  • 24. System Changes OS Upgrade Database Upgrade System Changes Network Changes Planned Outages 23
  • 25. Handle Database Upgrade Yes No PG 8.3+ ? Outage acceptable ? Outage No acceptable? Yes pg_upgrad No Yes e –check pass? Third Yes party Rep pg_dump No i.e Slony pg_restore Drop incompatible tables before upgrade and pg_upgrade restore after * Only showing recommended options 24
  • 26. Handle Data Changes Planned Outages Alter Schemas Data Changes Data growth 25
  • 27. Handle Alter schemas • Transactional DDL • CREATE or REPLACE views • NOT VALID • Checks • FKs • Add column without scanning entire table • NULLABLE • No Default 26
  • 28. Handle Data Changes Planned Outages Alter Schemas Data Changes Data growth 27
  • 29. Handle Data Growth PostgreSQL Bloat removal • Offline • VACUUM FULL • CLUSTER • Online • Rebuild index CONCURRENTLY • Rebuild table online using pg_reorg http://denishjpatel.blogspot.com/2011/03/extreme-training-session-at-pgeast-p90x.html 28
  • 30. Now we have …. 9 PITR Floating IP pg_extractor pg_reorg 29
  • 31. Maximum HA Architecture App Floating IP Master LB SRHS Bkp Failover Master SRHS Read WAL Slave 2 apply NAS Read Bkp Salve 1 30
  • 32. References • PostgreSQL Documentations • http://www.postgresql.org/docs/ • OmniTI Labs • https://labs.omniti.com/ • OMNIpitr • pg_extractor 30
  • 33. Thanks • PG Day NYC Conference Committee • OmniTI • You!! 31