SlideShare a Scribd company logo
Automating a PostgreSQL
High Availability
Architecture with Ansible
Vibhor Kumar, Chief Performance Architect
Marc Linster, Chief Technology Officer
November 2020
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.2
• Slides and recording will be available in next 48 hours
• Submit questions via Zoom – will be answering at end
• We will be sharing info about EDB and Postgres later
Welcome – Housekeeping Items
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.3
Agenda
• Introduction to EDB
• Concepts of high availability
• A quick review of EDB reference architectures
• EDB tools to create a highly available PostgreSQL architecture
• EDB Ansible® collections helping in automating the deployment of
reference architecture
• Features and capabilities of Ansible collections
• Automating the provisioning of the resources in the cloud using
Terraform™
• Summary and Q&A
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.4
The largest dedicated PostgreSQL company
• More customers: Than any dedicated PostgreSQL company
• More experts: Leading PostgreSQL contributors
• More innovation: Positioned to lead in enterprise PostgreSQL
and hybrid cloud
EDB acquires 2ndQuadrant in Sept 2020
+
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.5
EDB supercharges PostgreSQL
Largest dedicated
PostgreSQL company
Major PostgreSQL
community leader
Over 5,000 customers -
1 in 4 of Fortune 500
Founded in
2004
Over 10 years of
consecutive quarterly
subscription growth
500+
employees
Recognised leader in Relational
Database Management Systems
(RDBMS) by both Gartner and Forrester
2019
Challengers Leaders
Niche Players Visionaries
Abilitytoexecute
Completeness of
vision
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.6
EDB team includes:
More PostgreSQL experts
• 300+ PostgreSQL technologists
• 26 PostgreSQL community contributors and committers
• Including founders and leaders like
Michael Stonebraker
“Father of Postgres”
and EDB Advisor
Bruce Momjian
Co-founder, PostgreSQL
Development Corporation
and EDB Employee
Peter Eisentraut
PostgreSQL leader
and EDB Employee
Robert Haas
PostgreSQL Major
Contributor, Committer
and EDB Employee
Simon Riggs
Enterprise PostgreSQL
Expert and EDB Employee
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.7
High Availability
High availability (HA) is a characteristic of a
system, which aims to ensure an agreed level of
operational performance, usually uptime, for a
higher than normal period.
https://en.wikipedia.org/wiki/High_availability
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.8
High Availability
A note on Target Availability
• A target is NOT a guarantee!
• Availability is affected by more than just the software application:
• Operating system
• Hardware
• Network
• Environment (power, cooling, etc.)
• Upgrades/maintenance
• Quoted maximum target availabilities apply to EDB software maintenance only!
Availability Max downtime/year
99% 3d, 15h, 39m, 29s
99.9% 8h, 45m, 56s
99.99% 52m, 35s
99.999% 5m, 15s
99.9999% 31s
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.9
Calculating Availability
Best practice: measure in %:
(𝐴𝑔𝑟𝑒𝑒𝑑 𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑇𝑖𝑚𝑒 −𝐷𝑜𝑤𝑛𝑡𝑖𝑚𝑒)
𝐴 = X 100
(𝐴𝑔𝑟𝑒𝑒𝑑 𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑇𝑖𝑚𝑒)
● Agreed Service Time – defined in SLA (Service Level
Agreement)
● Downtime – duration of service unavailability during
Agreed Service Time
● Important when planning/deploying a service to
understand availability concept
● https://mikegold.org/calculateavailability/
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.10
RPO/RTO: Key Components of High Availability
Recovery Point Objective (RPO)/Recovery Time Objective (RTO)
Recovery Point Objective Recovery Time Objective
http://www.allnetkc.com/definitions.html
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.11
GRO: Key Component of High Availability
Geographic Redundancy Objective (GRO)
"... sometimes considered the disaster recovery requirement. This objective encompasses what data
needs to be replicated off site, how often and how far."
https://storageswiss.com/2014/01/22/backup-basics-what-do-slo-rpo-rto-vro-and-gro-
mean/#:~:text=Geographic%20Redundancy%20Objective&text=Simply%20put%2C%20users%20are%20more,multiple%2
0geographic%20requirements%20per%20application.
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.12
• A set of pre-designed tried-and-tested deployment patterns for PostgreSQL
• Intended as a starting point:
• Easy to try out
• Can be used as-is
• Can be used as a foundation
• Core architectures for the database server
• Add-on architectures provide additional capabilities
What are PostgreSQL Reference Architectures?
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.13
Core PostgreSQL Architectures
Database servers
• Single Node
• Multi-node cluster with asynchronous replication
• Multi-node cluster with synchronous replication
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.14
Single Node
Property Description
Recovery Time
Objective
Dependent on database size and backup
strategy
Recovery Point
Objective
Dependent on backup strategy
Geographic
Redundancy
Objective
N/A
Target Availability 99.9%
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.15
Multi Node with Asynchronous Replication
Property Description
Recovery Time
Objective
< 60 seconds
Recovery Point
Objective
Typically a few seconds or less during failover
(un-replicated transactions may be lost).
Dependent on backup strategy for full
recovery.
Geographic
Redundancy
Objective
Dependent on node placement. Typically
multi-availability zone.
Target Availability 99.99% (99.999% may be possible with
failover tuning)
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.16
Multi Node with Synchronous Replication
Property Description
Recovery Time
Objective
< 60 seconds
Recovery Point
Objective
Typically a few seconds or less during
failover, with no loss of committed
transactions. Dependent on backup strategy
for full recovery.
Geographic
Redundancy
Objective
Dependent on node placement. Typically
multi-availability zone.
Target Availability 99.99% (99.999% may be possible with
failover tuning)
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.17
Deployment Automation
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.18
Deployment Automation - DevOps Tool Survey
Technology Decision
• Terraform
• CloudFormation
• Ansible
• Chef
• Puppet
• Salt
• Configuration Management Vs Provisioning
• Procedural Vs Declarative
• Master Vs Master-less
• Mutable Infrastructure Vs Immutable
Infrastructure
• Agent Vs Agentless
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.19
Deployment Automation - June 2020 EDB DevOps Tool
Survey
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.20
Deployment Automation - What is Ansible?
• Technology to automate applications and configure
infrastructure
• Four level of abstractions for configuration
○ Task - single action
○ Task list - list of actions
○ Role
■ List of actions (or list of lists) grouped by the same
'subject'
■ A way to group tasks together into one container
○ Playbook
■ list of plays, each operating on possibly different
hostgroup, applying several roles/tasks/task lists
(and special tasks like handlers)
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.21
Deployment Automation - What is Ansible?
• Collections
○ Distribution format for Ansible content that can include
playbooks, roles, modules, and plugins.
• Ansible Playbooks setup and configure Single Node
or Multi-Node clusters are available.
• Repositories:
https://github.com/EnterpriseDB/edb-ansible
https://galaxy.ansible.com/edb_devops/edb_postgres
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.22
Deploy Reference Architecture with Single Command
• Deployment with ONE command
/usr/local/bin/ansible-playbook playbook.yml -u centos --private-key
~/id_rsa.pem
• Arguments:
○ playbook.yml
○ -u <server/vm user name>
○ --private-key <SSH Key>
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.23
Deployment Automation - playbook.yml
• os: Operating system version
• pg_version: Postgres version
• pg_type: EPAS/PG
○ EPAS: EDB Advanced Server
○ PostgreSQL
• yum_username
• ym_password
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.24
Deployment Automation - playbook.yml
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.25
Deployment Automation - Single Node hosts.yml
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.26
Deployment Automation - Multi Node hosts.yml
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.27
Deployment Automation
Multi Node with Monitoring and Automatic Failover
hosts.yml
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.28
Ansible Collections Features
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.29
pg_users:
- name: repuser
pass: <password>
conn_limit: 10
state: present
- name: abc_user
state: absent
pg_grant_privileges:
- roles: "efm_user"
database: "edb"
privileges: execute
schema: pg_catalog
objects: pg_current_wal_lsn()
type: function
Manage database users and privileges
pg_grant_roles:
- role: pg_monitor
user: enterprisedb
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.30
pg_postgres_conf_params:
- name: listen_addresses
value: "*"
- name: maintenance_work_mem
value: "128MB"
pg_hba_ip_addresses:
- contype: "host"
users: "all"
databases: "all"
method: "scram-sha-256"
source: "127.0.0.1/32"
state: present
Manage server configurations and databases
pg_databases:
- name: edb_gis
owner: edb
encoding: UTF-8
pg_extensions:
- name: "postgis"
database: "edb"
state: present
pg_slots:
- name: "physcial_slot"
slot_type: "physical"
state: present
- name: "logical_slot"
slot_type: "logical"
output_plugin: "test_decoding"
state: present
database: "edb"
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.31
pg_query:
- query: "UPDATE test SET id=2 WHERE id=1;"
db: "edb"
pg_copy_files:
- file: "/localdir/edb-sample.sql"
dest: "/usr/edb/as12/share/edb-sample.sql"
owner: "enterprisedb"
group: "enterprisedb"
pg_sql_scripts
- file_path: "/usr/edb/as12/share/edb-sample.sql"
db: edb
Execute query/SQL scripts and manage .pgpass
pg_pgpass_values:
- host: "*"
pg_port: 5444
database: edb
user: enterprisedb
password: <password>
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.32
Postgres Deployment Tools
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.33
Deploying Postgres in Public Cloud
• A thin bash CLI that uses
○ Terraform
■ Provision resources in a cloud
■ Maintain the state of the resources
■ Destroy/delete the provisioned resources
in a cloud
○ Ansible
■ Deployment and configuration of
Postgres
© Copyright EnterpriseDB Corporation, 2020. All rights reserved.34
Conclusion
Easy to use deployment patterns for PostgreSQL
EDB Reference Architectures make it easy to get your PostgreSQL
deployments up and running in battle-hardened configurations
• EDB Reference Architectures on Github
Automate the deployment patterns for PostgreSQL
• Repositories:
https://github.com/EnterpriseDB/edb-ansible
https://galaxy.ansible.com/edb_devops/edb_postgres
• Postgres-deployment repository
https://github.com/EnterpriseDB/postgres-deployment Thank You

More Related Content

PDF
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
PDF
[2018] MySQL 이중화 진화기
PPTX
Stephan Ewen - Experiences running Flink at Very Large Scale
PDF
MySQL Database Monitoring: Must, Good and Nice to Have
PPTX
Achieving High Availability in PostgreSQL
PDF
Dreaming Infrastructure
PPTX
Sonar qubeでちょっと楽しい静的解析
PPTX
Oracle GoldenGate 18c - REST API Examples
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
[2018] MySQL 이중화 진화기
Stephan Ewen - Experiences running Flink at Very Large Scale
MySQL Database Monitoring: Must, Good and Nice to Have
Achieving High Availability in PostgreSQL
Dreaming Infrastructure
Sonar qubeでちょっと楽しい静的解析
Oracle GoldenGate 18c - REST API Examples

What's hot (20)

PDF
M|18 Deep Dive: InnoDB Transactions and Write Paths
PPTX
Apache Kafka Best Practices
PDF
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
PDF
Apache Kafka Fundamentals for Architects, Admins and Developers
PPTX
Kafka 101
PDF
片手間MySQLチューニング戦略
PPTX
How YugaByte DB Implements Distributed PostgreSQL
PDF
雑なMySQLパフォーマンスチューニング
PDF
How Booking.com avoids and deals with replication lag
PDF
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
PPTX
AlloyDBを触ってみた!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
PDF
MySQL Database Architectures - High Availability and Disaster Recovery Solution
PPTX
Running MariaDB in multiple data centers
PPTX
PostgreSQLのfull_page_writesについて(第24回PostgreSQLアンカンファレンス@オンライン 発表資料)
PDF
Disaster Recovery Plans for Apache Kafka
PPTX
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
PDF
Google Cloud Platform Solutions for DevOps Engineers
PDF
Technical Introduction to PostgreSQL and PPAS
PDF
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
PDF
Solving PostgreSQL wicked problems
M|18 Deep Dive: InnoDB Transactions and Write Paths
Apache Kafka Best Practices
Almost Perfect Service Discovery and Failover with ProxySQL and Orchestrator
Apache Kafka Fundamentals for Architects, Admins and Developers
Kafka 101
片手間MySQLチューニング戦略
How YugaByte DB Implements Distributed PostgreSQL
雑なMySQLパフォーマンスチューニング
How Booking.com avoids and deals with replication lag
Amazon S3 Best Practice and Tuning for Hadoop/Spark in the Cloud
AlloyDBを触ってみた!(第33回PostgreSQLアンカンファレンス@オンライン 発表資料)
MySQL Database Architectures - High Availability and Disaster Recovery Solution
Running MariaDB in multiple data centers
PostgreSQLのfull_page_writesについて(第24回PostgreSQLアンカンファレンス@オンライン 発表資料)
Disaster Recovery Plans for Apache Kafka
How and Why GraalVM is quickly becoming relevant for developers (ACEs@home - ...
Google Cloud Platform Solutions for DevOps Engineers
Technical Introduction to PostgreSQL and PPAS
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Solving PostgreSQL wicked problems
Ad

Similar to Automating a PostgreSQL High Availability Architecture with Ansible (20)

PPTX
An overview of reference architectures for Postgres
 
PPTX
How to Design for Database High Availability
 
PPTX
An overview of reference architectures for Postgres
 
PDF
Making your PostgreSQL Database Highly Available
 
PDF
Postgres Deployment Automation with Terraform and Ansible
 
PPTX
Which PostgreSQL is right for your multi cloud strategy? P2
PDF
Creating customized openSUSE versions with SUSE Studio
PPTX
Overcoming write availability challenges of PostgreSQL
 
PDF
Best Practices & Lessons Learned from Deployment of PostgreSQL
 
PDF
PostgreSQL HA
PDF
Beginner's Guide to High Availability for Postgres - French
 
PDF
Architecture for building scalable and highly available Postgres Cluster
PPTX
Automating Postgres Deployments on AWS and VMware, with Terraform and Ansible
 
PPTX
PostgreSQL to Accelerate Innovation
 
PPTX
Beginner's Guide to High Availability for Postgres
 
PDF
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
PPTX
Public Sector Virtual Town Hall: High Availability for PostgreSQL
 
PPTX
Beginners Guide to High Availability for Postgres
 
PDF
Beginner's Guide to High Availability for Postgres
 
PDF
Best Practices for a Complete Postgres Enterprise Architecture Setup
 
An overview of reference architectures for Postgres
 
How to Design for Database High Availability
 
An overview of reference architectures for Postgres
 
Making your PostgreSQL Database Highly Available
 
Postgres Deployment Automation with Terraform and Ansible
 
Which PostgreSQL is right for your multi cloud strategy? P2
Creating customized openSUSE versions with SUSE Studio
Overcoming write availability challenges of PostgreSQL
 
Best Practices & Lessons Learned from Deployment of PostgreSQL
 
PostgreSQL HA
Beginner's Guide to High Availability for Postgres - French
 
Architecture for building scalable and highly available Postgres Cluster
Automating Postgres Deployments on AWS and VMware, with Terraform and Ansible
 
PostgreSQL to Accelerate Innovation
 
Beginner's Guide to High Availability for Postgres
 
What’s the Best PostgreSQL High Availability Framework? PAF vs. repmgr vs. Pa...
Public Sector Virtual Town Hall: High Availability for PostgreSQL
 
Beginners Guide to High Availability for Postgres
 
Beginner's Guide to High Availability for Postgres
 
Best Practices for a Complete Postgres Enterprise Architecture Setup
 
Ad

More from EDB (20)

PDF
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
PDF
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
PDF
Migre sus bases de datos Oracle a la nube
 
PDF
EFM Office Hours - APJ - July 29, 2021
 
PDF
Benchmarking Cloud Native PostgreSQL
 
PDF
Las Variaciones de la Replicación de PostgreSQL
 
PDF
NoSQL and Spatial Database Capabilities using PostgreSQL
 
PDF
Is There Anything PgBouncer Can’t Do?
 
PDF
Data Analysis with TensorFlow in PostgreSQL
 
PDF
Practical Partitioning in Production with Postgres
 
PDF
A Deeper Dive into EXPLAIN
 
PDF
IOT with PostgreSQL
 
PDF
A Journey from Oracle to PostgreSQL
 
PDF
Psql is awesome!
 
PDF
EDB 13 - New Enhancements for Security and Usability - APJ
 
PPTX
Comment sauvegarder correctement vos données
 
PDF
Cloud Native PostgreSQL - Italiano
 
PDF
New enhancements for security and usability in EDB 13
 
PPTX
Best Practices in Security with PostgreSQL
 
PDF
Cloud Native PostgreSQL - APJ
 
Cloud Migration Paths: Kubernetes, IaaS, or DBaaS
 
Die 10 besten PostgreSQL-Replikationsstrategien für Ihr Unternehmen
 
Migre sus bases de datos Oracle a la nube
 
EFM Office Hours - APJ - July 29, 2021
 
Benchmarking Cloud Native PostgreSQL
 
Las Variaciones de la Replicación de PostgreSQL
 
NoSQL and Spatial Database Capabilities using PostgreSQL
 
Is There Anything PgBouncer Can’t Do?
 
Data Analysis with TensorFlow in PostgreSQL
 
Practical Partitioning in Production with Postgres
 
A Deeper Dive into EXPLAIN
 
IOT with PostgreSQL
 
A Journey from Oracle to PostgreSQL
 
Psql is awesome!
 
EDB 13 - New Enhancements for Security and Usability - APJ
 
Comment sauvegarder correctement vos données
 
Cloud Native PostgreSQL - Italiano
 
New enhancements for security and usability in EDB 13
 
Best Practices in Security with PostgreSQL
 
Cloud Native PostgreSQL - APJ
 

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Machine learning based COVID-19 study performance prediction
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Advanced IT Governance
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Cloud computing and distributed systems.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
NewMind AI Monthly Chronicles - July 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Machine learning based COVID-19 study performance prediction
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Advanced IT Governance
20250228 LYD VKU AI Blended-Learning.pptx
GamePlan Trading System Review: Professional Trader's Honest Take
Unlocking AI with Model Context Protocol (MCP)
Understanding_Digital_Forensics_Presentation.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Cloud computing and distributed systems.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Reach Out and Touch Someone: Haptics and Empathic Computing
NewMind AI Monthly Chronicles - July 2025

Automating a PostgreSQL High Availability Architecture with Ansible

  • 1. Automating a PostgreSQL High Availability Architecture with Ansible Vibhor Kumar, Chief Performance Architect Marc Linster, Chief Technology Officer November 2020
  • 2. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.2 • Slides and recording will be available in next 48 hours • Submit questions via Zoom – will be answering at end • We will be sharing info about EDB and Postgres later Welcome – Housekeeping Items
  • 3. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.3 Agenda • Introduction to EDB • Concepts of high availability • A quick review of EDB reference architectures • EDB tools to create a highly available PostgreSQL architecture • EDB Ansible® collections helping in automating the deployment of reference architecture • Features and capabilities of Ansible collections • Automating the provisioning of the resources in the cloud using Terraform™ • Summary and Q&A
  • 4. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.4 The largest dedicated PostgreSQL company • More customers: Than any dedicated PostgreSQL company • More experts: Leading PostgreSQL contributors • More innovation: Positioned to lead in enterprise PostgreSQL and hybrid cloud EDB acquires 2ndQuadrant in Sept 2020 +
  • 5. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.5 EDB supercharges PostgreSQL Largest dedicated PostgreSQL company Major PostgreSQL community leader Over 5,000 customers - 1 in 4 of Fortune 500 Founded in 2004 Over 10 years of consecutive quarterly subscription growth 500+ employees Recognised leader in Relational Database Management Systems (RDBMS) by both Gartner and Forrester 2019 Challengers Leaders Niche Players Visionaries Abilitytoexecute Completeness of vision
  • 6. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.6 EDB team includes: More PostgreSQL experts • 300+ PostgreSQL technologists • 26 PostgreSQL community contributors and committers • Including founders and leaders like Michael Stonebraker “Father of Postgres” and EDB Advisor Bruce Momjian Co-founder, PostgreSQL Development Corporation and EDB Employee Peter Eisentraut PostgreSQL leader and EDB Employee Robert Haas PostgreSQL Major Contributor, Committer and EDB Employee Simon Riggs Enterprise PostgreSQL Expert and EDB Employee
  • 7. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.7 High Availability High availability (HA) is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period. https://en.wikipedia.org/wiki/High_availability
  • 8. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.8 High Availability A note on Target Availability • A target is NOT a guarantee! • Availability is affected by more than just the software application: • Operating system • Hardware • Network • Environment (power, cooling, etc.) • Upgrades/maintenance • Quoted maximum target availabilities apply to EDB software maintenance only! Availability Max downtime/year 99% 3d, 15h, 39m, 29s 99.9% 8h, 45m, 56s 99.99% 52m, 35s 99.999% 5m, 15s 99.9999% 31s
  • 9. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.9 Calculating Availability Best practice: measure in %: (𝐴𝑔𝑟𝑒𝑒𝑑 𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑇𝑖𝑚𝑒 −𝐷𝑜𝑤𝑛𝑡𝑖𝑚𝑒) 𝐴 = X 100 (𝐴𝑔𝑟𝑒𝑒𝑑 𝑆𝑒𝑟𝑣𝑖𝑐𝑒 𝑇𝑖𝑚𝑒) ● Agreed Service Time – defined in SLA (Service Level Agreement) ● Downtime – duration of service unavailability during Agreed Service Time ● Important when planning/deploying a service to understand availability concept ● https://mikegold.org/calculateavailability/
  • 10. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.10 RPO/RTO: Key Components of High Availability Recovery Point Objective (RPO)/Recovery Time Objective (RTO) Recovery Point Objective Recovery Time Objective http://www.allnetkc.com/definitions.html
  • 11. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.11 GRO: Key Component of High Availability Geographic Redundancy Objective (GRO) "... sometimes considered the disaster recovery requirement. This objective encompasses what data needs to be replicated off site, how often and how far." https://storageswiss.com/2014/01/22/backup-basics-what-do-slo-rpo-rto-vro-and-gro- mean/#:~:text=Geographic%20Redundancy%20Objective&text=Simply%20put%2C%20users%20are%20more,multiple%2 0geographic%20requirements%20per%20application.
  • 12. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.12 • A set of pre-designed tried-and-tested deployment patterns for PostgreSQL • Intended as a starting point: • Easy to try out • Can be used as-is • Can be used as a foundation • Core architectures for the database server • Add-on architectures provide additional capabilities What are PostgreSQL Reference Architectures?
  • 13. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.13 Core PostgreSQL Architectures Database servers • Single Node • Multi-node cluster with asynchronous replication • Multi-node cluster with synchronous replication
  • 14. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.14 Single Node Property Description Recovery Time Objective Dependent on database size and backup strategy Recovery Point Objective Dependent on backup strategy Geographic Redundancy Objective N/A Target Availability 99.9%
  • 15. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.15 Multi Node with Asynchronous Replication Property Description Recovery Time Objective < 60 seconds Recovery Point Objective Typically a few seconds or less during failover (un-replicated transactions may be lost). Dependent on backup strategy for full recovery. Geographic Redundancy Objective Dependent on node placement. Typically multi-availability zone. Target Availability 99.99% (99.999% may be possible with failover tuning)
  • 16. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.16 Multi Node with Synchronous Replication Property Description Recovery Time Objective < 60 seconds Recovery Point Objective Typically a few seconds or less during failover, with no loss of committed transactions. Dependent on backup strategy for full recovery. Geographic Redundancy Objective Dependent on node placement. Typically multi-availability zone. Target Availability 99.99% (99.999% may be possible with failover tuning)
  • 17. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.17 Deployment Automation
  • 18. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.18 Deployment Automation - DevOps Tool Survey Technology Decision • Terraform • CloudFormation • Ansible • Chef • Puppet • Salt • Configuration Management Vs Provisioning • Procedural Vs Declarative • Master Vs Master-less • Mutable Infrastructure Vs Immutable Infrastructure • Agent Vs Agentless
  • 19. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.19 Deployment Automation - June 2020 EDB DevOps Tool Survey
  • 20. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.20 Deployment Automation - What is Ansible? • Technology to automate applications and configure infrastructure • Four level of abstractions for configuration ○ Task - single action ○ Task list - list of actions ○ Role ■ List of actions (or list of lists) grouped by the same 'subject' ■ A way to group tasks together into one container ○ Playbook ■ list of plays, each operating on possibly different hostgroup, applying several roles/tasks/task lists (and special tasks like handlers)
  • 21. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.21 Deployment Automation - What is Ansible? • Collections ○ Distribution format for Ansible content that can include playbooks, roles, modules, and plugins. • Ansible Playbooks setup and configure Single Node or Multi-Node clusters are available. • Repositories: https://github.com/EnterpriseDB/edb-ansible https://galaxy.ansible.com/edb_devops/edb_postgres
  • 22. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.22 Deploy Reference Architecture with Single Command • Deployment with ONE command /usr/local/bin/ansible-playbook playbook.yml -u centos --private-key ~/id_rsa.pem • Arguments: ○ playbook.yml ○ -u <server/vm user name> ○ --private-key <SSH Key>
  • 23. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.23 Deployment Automation - playbook.yml • os: Operating system version • pg_version: Postgres version • pg_type: EPAS/PG ○ EPAS: EDB Advanced Server ○ PostgreSQL • yum_username • ym_password
  • 24. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.24 Deployment Automation - playbook.yml
  • 25. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.25 Deployment Automation - Single Node hosts.yml
  • 26. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.26 Deployment Automation - Multi Node hosts.yml
  • 27. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.27 Deployment Automation Multi Node with Monitoring and Automatic Failover hosts.yml
  • 28. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.28 Ansible Collections Features
  • 29. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.29 pg_users: - name: repuser pass: <password> conn_limit: 10 state: present - name: abc_user state: absent pg_grant_privileges: - roles: "efm_user" database: "edb" privileges: execute schema: pg_catalog objects: pg_current_wal_lsn() type: function Manage database users and privileges pg_grant_roles: - role: pg_monitor user: enterprisedb
  • 30. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.30 pg_postgres_conf_params: - name: listen_addresses value: "*" - name: maintenance_work_mem value: "128MB" pg_hba_ip_addresses: - contype: "host" users: "all" databases: "all" method: "scram-sha-256" source: "127.0.0.1/32" state: present Manage server configurations and databases pg_databases: - name: edb_gis owner: edb encoding: UTF-8 pg_extensions: - name: "postgis" database: "edb" state: present pg_slots: - name: "physcial_slot" slot_type: "physical" state: present - name: "logical_slot" slot_type: "logical" output_plugin: "test_decoding" state: present database: "edb"
  • 31. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.31 pg_query: - query: "UPDATE test SET id=2 WHERE id=1;" db: "edb" pg_copy_files: - file: "/localdir/edb-sample.sql" dest: "/usr/edb/as12/share/edb-sample.sql" owner: "enterprisedb" group: "enterprisedb" pg_sql_scripts - file_path: "/usr/edb/as12/share/edb-sample.sql" db: edb Execute query/SQL scripts and manage .pgpass pg_pgpass_values: - host: "*" pg_port: 5444 database: edb user: enterprisedb password: <password>
  • 32. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.32 Postgres Deployment Tools
  • 33. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.33 Deploying Postgres in Public Cloud • A thin bash CLI that uses ○ Terraform ■ Provision resources in a cloud ■ Maintain the state of the resources ■ Destroy/delete the provisioned resources in a cloud ○ Ansible ■ Deployment and configuration of Postgres
  • 34. © Copyright EnterpriseDB Corporation, 2020. All rights reserved.34 Conclusion Easy to use deployment patterns for PostgreSQL EDB Reference Architectures make it easy to get your PostgreSQL deployments up and running in battle-hardened configurations • EDB Reference Architectures on Github Automate the deployment patterns for PostgreSQL • Repositories: https://github.com/EnterpriseDB/edb-ansible https://galaxy.ansible.com/edb_devops/edb_postgres • Postgres-deployment repository https://github.com/EnterpriseDB/postgres-deployment Thank You