SlideShare a Scribd company logo
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

More Related Content

What's hot (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...
VMworld
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
Jignesh Shah
 
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris EnvironmentTuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris Environment
Jignesh Shah
 
My experience with embedding PostgreSQL
 My experience with embedding PostgreSQL My experience with embedding PostgreSQL
My experience with embedding PostgreSQL
Jignesh Shah
 
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisBest Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
Jignesh Shah
 
X-DB Replication Server and MMR
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMR
Ashnikbiz
 
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
VMworld
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
Masao Fujii
 
Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL Universe
Jignesh Shah
 
Understanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksUnderstanding PostgreSQL LW Locks
Understanding PostgreSQL LW Locks
Jignesh Shah
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing Databases
VMworld
 
PostgreSQL and Benchmarks
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and Benchmarks
Jignesh 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 Machine
heraflux
 
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 Databases
Ashnikbiz
 
OVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud DatabasesOVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud Databases
OVHcloud
 
Storage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, WhiptailStorage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, Whiptail
Internet World
 
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
Microsoft TechNet - Belgium and Luxembourg
 
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
Blue Medora
 
Master VMware Performance and Capacity Management
Master VMware Performance and Capacity ManagementMaster VMware Performance and Capacity Management
Master VMware Performance and Capacity Management
Iwan Rahabok
 
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 Containers
Jignesh Shah
 
Tuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris EnvironmentTuning DB2 in a Solaris Environment
Tuning DB2 in a Solaris Environment
Jignesh Shah
 
My experience with embedding PostgreSQL
 My experience with embedding PostgreSQL My experience with embedding PostgreSQL
My experience with embedding PostgreSQL
Jignesh Shah
 
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisBest Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
Jignesh Shah
 
X-DB Replication Server and MMR
X-DB Replication Server and MMRX-DB Replication Server and MMR
X-DB Replication Server and MMR
Ashnikbiz
 
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
VMworld
 
PostgreSQL replication
PostgreSQL replicationPostgreSQL replication
PostgreSQL replication
Masao Fujii
 
Deep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL UniverseDeep Dive into RDS PostgreSQL Universe
Deep Dive into RDS PostgreSQL Universe
Jignesh Shah
 
Understanding PostgreSQL LW Locks
Understanding PostgreSQL LW LocksUnderstanding PostgreSQL LW Locks
Understanding PostgreSQL LW Locks
Jignesh Shah
 
VMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing DatabasesVMworld 2014: Virtualizing Databases
VMworld 2014: Virtualizing Databases
VMworld
 
PostgreSQL and Benchmarks
PostgreSQL and BenchmarksPostgreSQL and Benchmarks
PostgreSQL and Benchmarks
Jignesh 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 Machine
heraflux
 
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 Databases
Ashnikbiz
 
OVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud DatabasesOVH Lab - Enterprise Cloud Databases
OVH Lab - Enterprise Cloud Databases
OVHcloud
 
Storage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, WhiptailStorage and performance- Batch processing, Whiptail
Storage and performance- Batch processing, Whiptail
Internet 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 PostgreSQL
Blue Medora
 
Master VMware Performance and Capacity Management
Master VMware Performance and Capacity ManagementMaster VMware Performance and Capacity Management
Master VMware Performance and Capacity Management
Iwan Rahabok
 

Similar to 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
Denish Patel
 
saurabh soni rac
saurabh soni racsaurabh soni rac
saurabh soni rac
saurabh soni
 
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
Neverfail Group
 
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLAKoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
Tobias Koprowski
 
Polyserve DB Consolidation Platform - Clemens Esser
Polyserve DB Consolidation Platform - Clemens EsserPolyserve DB Consolidation Platform - Clemens Esser
Polyserve DB Consolidation Platform - Clemens Esser
HPDutchWorld
 
SANsymphony V
SANsymphony VSANsymphony V
SANsymphony V
TTEC
 
Evolving from Products to Product Suite Solutions in High-Tech
Evolving from Products to Product Suite Solutions in High-TechEvolving from Products to Product Suite Solutions in High-Tech
Evolving from Products to Product Suite Solutions in High-Tech
SVPMA
 
Oracle rac 10g best practices
Oracle rac 10g best practicesOracle rac 10g best practices
Oracle rac 10g best practices
Haseeb Alam
 
Architecting a Private Cloud - Cloud Expo
Architecting a Private Cloud - Cloud ExpoArchitecting a Private Cloud - Cloud Expo
Architecting a Private Cloud - Cloud Expo
smw355
 
Real-time Data Distribution: When Tomorrow is Too Late
Real-time Data Distribution: When Tomorrow is Too LateReal-time Data Distribution: When Tomorrow is Too Late
Real-time Data Distribution: When Tomorrow is Too Late
Inside Analysis
 
Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2
Sal Marcuz
 
Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2
Sal Marcuz
 
Talk IT_ Oracle_정병선_110928
Talk IT_ Oracle_정병선_110928Talk IT_ Oracle_정병선_110928
Talk IT_ Oracle_정병선_110928
Cana Ko
 
SQL Server 2008 para Implementar Biztalk
SQL Server 2008 para Implementar BiztalkSQL Server 2008 para Implementar Biztalk
SQL Server 2008 para Implementar Biztalk
Eduardo Castro
 
Business Continuity Vulnerability Index
Business Continuity Vulnerability IndexBusiness Continuity Vulnerability Index
Business Continuity Vulnerability Index
continuity
 
IT Automation Assessment Report - sample
IT Automation Assessment Report - sampleIT Automation Assessment Report - sample
IT Automation Assessment Report - sample
Evergreen Systems
 
DevOps як System Administration 2.0
DevOps як System Administration 2.0DevOps як System Administration 2.0
DevOps як System Administration 2.0
SoftServe
 
High Availability og virtualisering, IBM Power Event
High Availability og virtualisering, IBM Power EventHigh Availability og virtualisering, IBM Power Event
High Availability og virtualisering, IBM Power Event
IBM Danmark
 
Microsoft's Cloud OS Launch, Revisited
Microsoft's Cloud OS Launch, RevisitedMicrosoft's Cloud OS Launch, Revisited
Microsoft's Cloud OS Launch, Revisited
C/D/H Technology Consultants
 
Architecting for failures in the Cloud - Barcamp Bangalore 2013
Architecting for failures in the Cloud - Barcamp Bangalore 2013Architecting for failures in the Cloud - Barcamp Bangalore 2013
Architecting for failures in the Cloud - Barcamp Bangalore 2013
P3 InfoTech Solutions Pvt. Ltd.
 
Deploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQLDeploying Maximum HA Architecture With PostgreSQL
Deploying Maximum HA Architecture With PostgreSQL
Denish Patel
 
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
Neverfail Group
 
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLAKoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
KoprowskiT_SQLSat152_Bulgaria_HighAvailabilityOfSQLintheContextOfSLA
Tobias Koprowski
 
Polyserve DB Consolidation Platform - Clemens Esser
Polyserve DB Consolidation Platform - Clemens EsserPolyserve DB Consolidation Platform - Clemens Esser
Polyserve DB Consolidation Platform - Clemens Esser
HPDutchWorld
 
SANsymphony V
SANsymphony VSANsymphony V
SANsymphony V
TTEC
 
Evolving from Products to Product Suite Solutions in High-Tech
Evolving from Products to Product Suite Solutions in High-TechEvolving from Products to Product Suite Solutions in High-Tech
Evolving from Products to Product Suite Solutions in High-Tech
SVPMA
 
Oracle rac 10g best practices
Oracle rac 10g best practicesOracle rac 10g best practices
Oracle rac 10g best practices
Haseeb Alam
 
Architecting a Private Cloud - Cloud Expo
Architecting a Private Cloud - Cloud ExpoArchitecting a Private Cloud - Cloud Expo
Architecting a Private Cloud - Cloud Expo
smw355
 
Real-time Data Distribution: When Tomorrow is Too Late
Real-time Data Distribution: When Tomorrow is Too LateReal-time Data Distribution: When Tomorrow is Too Late
Real-time Data Distribution: When Tomorrow is Too Late
Inside Analysis
 
Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2
Sal Marcuz
 
Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2Maa wp sun_apps11i_db10g_r2-2
Maa wp sun_apps11i_db10g_r2-2
Sal Marcuz
 
Talk IT_ Oracle_정병선_110928
Talk IT_ Oracle_정병선_110928Talk IT_ Oracle_정병선_110928
Talk IT_ Oracle_정병선_110928
Cana Ko
 
SQL Server 2008 para Implementar Biztalk
SQL Server 2008 para Implementar BiztalkSQL Server 2008 para Implementar Biztalk
SQL Server 2008 para Implementar Biztalk
Eduardo Castro
 
Business Continuity Vulnerability Index
Business Continuity Vulnerability IndexBusiness Continuity Vulnerability Index
Business Continuity Vulnerability Index
continuity
 
IT Automation Assessment Report - sample
IT Automation Assessment Report - sampleIT Automation Assessment Report - sample
IT Automation Assessment Report - sample
Evergreen Systems
 
DevOps як System Administration 2.0
DevOps як System Administration 2.0DevOps як System Administration 2.0
DevOps як System Administration 2.0
SoftServe
 
High Availability og virtualisering, IBM Power Event
High Availability og virtualisering, IBM Power EventHigh Availability og virtualisering, IBM Power Event
High Availability og virtualisering, IBM Power Event
IBM Danmark
 
Architecting for failures in the Cloud - Barcamp Bangalore 2013
Architecting for failures in the Cloud - Barcamp Bangalore 2013Architecting for failures in the Cloud - Barcamp Bangalore 2013
Architecting for failures in the Cloud - Barcamp Bangalore 2013
P3 InfoTech Solutions Pvt. Ltd.
 
Ad

More from Denish Patel (17)

Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
Denish 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.4
Denish Patel
 
Postgres in Amazon RDS
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDS
Denish Patel
 
Choosing the "D" , Lightning talk
Choosing the "D" , Lightning talkChoosing the "D" , Lightning talk
Choosing the "D" , Lightning talk
Denish Patel
 
Scaling postgres
Scaling postgresScaling postgres
Scaling postgres
Denish 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 Room
Denish 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 Compliace
Denish Patel
 
Using SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionUsing SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparition
Denish Patel
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
Denish Patel
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRep
Denish Patel
 
Advanced Postgres Monitoring
Advanced Postgres MonitoringAdvanced Postgres Monitoring
Advanced Postgres Monitoring
Denish 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.4
Denish Patel
 
Postgres in Amazon RDS
Postgres in Amazon RDSPostgres in Amazon RDS
Postgres in Amazon RDS
Denish Patel
 
Choosing the "D" , Lightning talk
Choosing the "D" , Lightning talkChoosing the "D" , Lightning talk
Choosing the "D" , Lightning talk
Denish 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 Room
Denish 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 Compliace
Denish Patel
 
Using SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparitionUsing SQL Standards? Database SQL comparition
Using SQL Standards? Database SQL comparition
Denish Patel
 
Oracle10g New Features I
Oracle10g New Features IOracle10g New Features I
Oracle10g New Features I
Denish Patel
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRep
Denish Patel
 
Ad

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 : [email protected] • 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