SlideShare uma empresa Scribd logo
1 de 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!!
                                          Apply @ l42.org/lg
       •   Consistency

       •   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 Failures    Prevent
                                    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
                                           pg_upgrade           upgrade and
* Only showing recommended options                             restore after

                                      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

Mais conteúdo relacionado

Mais procurados

VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...
VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...
VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...VMworld
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux ContainersJignesh Shah
 
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris EnvironmentTuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris EnvironmentJignesh Shah
 
My experience with embedding PostgreSQL
 My experience with embedding PostgreSQL My experience with embedding PostgreSQL
My experience with embedding PostgreSQLJignesh Shah
 
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisBest Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisJignesh Shah
 
X-DB Replication Server and MMR
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMRAshnikbiz
 
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best PracticesVMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best PracticesVMworld
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replicationMasao Fujii
 
Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseJignesh Shah
 
Understanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksUnderstanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksJignesh Shah
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld
 
PostgreSQL and Benchmarks
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and BenchmarksJignesh Shah
 
Right-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual MachineRight-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual Machineheraflux
 
VMworld 2013: How SRP Delivers More Than Power to Their Customers
VMworld 2013: How SRP Delivers More Than Power to Their Customers VMworld 2013: How SRP Delivers More Than Power to Their Customers
VMworld 2013: How SRP Delivers More Than Power to Their Customers VMworld
 
Enterprise PostgreSQL - EDB's answer to conventional Databases
Enterprise PostgreSQL - EDB's answer to conventional DatabasesEnterprise PostgreSQL - EDB's answer to conventional Databases
Enterprise PostgreSQL - EDB's answer to conventional DatabasesAshnikbiz
 
OVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud DatabasesOVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud DatabasesOVHcloud
 
Storage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, WhiptailStorage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, WhiptailInternet World
 
Blue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQL
Blue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQLBlue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQL
Blue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQLBlue Medora
 
Master VMware Performance and Capacity Management
Master VMware Performance and Capacity ManagementMaster VMware Performance and Capacity Management
Master VMware Performance and Capacity ManagementIwan Rahabok
 

Mais procurados (20)

VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...
VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...
VMworld 2013: Big Data: Virtualized SAP HANA Performance, Scalability and Bes...
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
 
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris EnvironmentTuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris Environment
 
My experience with embedding PostgreSQL
 My experience with embedding PostgreSQL My experience with embedding PostgreSQL
My experience with embedding PostgreSQL
 
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisBest Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
 
X-DB Replication Server and MMR
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMR
 
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best PracticesVMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
VMworld 2014: Advanced SQL Server on vSphere Techniques and Best Practices
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
 
Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL Universe
 
Understanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksUnderstanding PostgreSQL LW Locks
Understanding PostgreSQL LW Locks
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing Databases
 
PostgreSQL and Benchmarks
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and Benchmarks
 
Right-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual MachineRight-Sizing your SQL Server Virtual Machine
Right-Sizing your SQL Server Virtual Machine
 
VMworld 2013: How SRP Delivers More Than Power to Their Customers
VMworld 2013: How SRP Delivers More Than Power to Their Customers VMworld 2013: How SRP Delivers More Than Power to Their Customers
VMworld 2013: How SRP Delivers More Than Power to Their Customers
 
Enterprise PostgreSQL - EDB's answer to conventional Databases
Enterprise PostgreSQL - EDB's answer to conventional DatabasesEnterprise PostgreSQL - EDB's answer to conventional Databases
Enterprise PostgreSQL - EDB's answer to conventional Databases
 
OVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud DatabasesOVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud Databases
 
Storage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, WhiptailStorage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, Whiptail
 
Exchange Server 2013 High Availability - Site Resilience
Exchange Server 2013 High Availability - Site ResilienceExchange Server 2013 High Availability - Site Resilience
Exchange Server 2013 High Availability - Site Resilience
 
Blue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQL
Blue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQLBlue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQL
Blue Medora Oracle Enterprise Manager (EM12c) Plug-in for PostgreSQL
 
Master VMware Performance and Capacity Management
Master VMware Performance and Capacity ManagementMaster VMware Performance and Capacity Management
Master VMware Performance and Capacity Management
 

Semelhante a 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
 
NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012Michael Harding
 
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
 
Best Practices for Virtualizing Hadoop
Best Practices for Virtualizing HadoopBest Practices for Virtualizing Hadoop
Best Practices for Virtualizing HadoopDataWorks Summit
 
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.
 
5 Ways to Avoid Server and Application Downtime
5 Ways to Avoid Server and Application Downtime5 Ways to Avoid Server and Application Downtime
5 Ways to Avoid Server and Application DowntimeNeverfail Group
 
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
 
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
 
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
 
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
 
Yahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsYahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsConSanFrancisco123
 
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.
 
Life After Sharding: Monitoring and Management of a Complex Data Cloud
Life After Sharding: Monitoring and Management of a Complex Data CloudLife After Sharding: Monitoring and Management of a Complex Data Cloud
Life After Sharding: Monitoring and Management of a Complex Data CloudOSCON Byrum
 
Database & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdf
Database & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdfDatabase & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdf
Database & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdfInSync2011
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008mwlang88
 
Severalnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines
 

Semelhante a 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
 
NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012NetApp-ClusteredONTAP-Fall2012
NetApp-ClusteredONTAP-Fall2012
 
Oow Ppt 2
Oow Ppt 2Oow Ppt 2
Oow Ppt 2
 
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
 
Best Practices for Virtualizing Hadoop
Best Practices for Virtualizing HadoopBest Practices for Virtualizing Hadoop
Best Practices for Virtualizing Hadoop
 
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
 
5 Ways to Avoid Server and Application Downtime
5 Ways to Avoid Server and Application Downtime5 Ways to Avoid Server and Application Downtime
5 Ways to Avoid Server and Application Downtime
 
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
 
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
 
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...
 
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...
 
Yahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely BedfellowsYahoo Communities Architecture Unlikely Bedfellows
Yahoo Communities Architecture Unlikely Bedfellows
 
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…
 
Life After Sharding: Monitoring and Management of a Complex Data Cloud
Life After Sharding: Monitoring and Management of a Complex Data CloudLife After Sharding: Monitoring and Management of a Complex Data Cloud
Life After Sharding: Monitoring and Management of a Complex Data Cloud
 
Database & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdf
Database & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdfDatabase & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdf
Database & Technology 2 _ Marting Lambert _ Mixed Workloads Why and How.pdf
 
Xen Virtualization 2008
Xen Virtualization 2008Xen Virtualization 2008
Xen Virtualization 2008
 
Severalnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IXSeveralnines Training: MySQL® Cluster - Part IX
Severalnines Training: MySQL® Cluster - Part IX
 

Mais de 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
 
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
 
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
 

Mais de Denish Patel (17)

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)
 
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)
 
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
 
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!! Apply @ l42.org/lg • Consistency • 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 Failures Prevent 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 pg_upgrade upgrade and * Only showing recommended options restore after 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