Download presentation
Presentation is loading. Please wait.
Published byΖένια Αυγερινός Modified over 6 years ago
1
Provisioning and Automating High Availability Postgres on AWS EC2
Payal Singh 1
2
Who am I? DBA@OmniTI Github: payals
Blog: 2
3
Agenda vs Design Automation 3
4
Why EC2 over RDS? Control Debugging Third party tools Resources
Flexibility Migration - globals Compatibility with non-AWS resources Monitoring 4
5
If you’re going from RDS to EC2...
More administration Less handholding Security Basic monitoring 5
6
Automation Tools 6
7
Popular Automation Tools
7
8
Types of Tools 8
9
What is Terraform? Tool for building, changing and versioning infrastructure Specializes in cloud infrastructure management 9
10
10
11
Why I chose Ansible Simple Learning curve Galaxy and modules
Push - more convenient Clarity - YAML 11
12
Design 12
13
What to Design? EC2 Setup Installs and reinstalls, dependencies
Tuning and customization Replication Backups Monitoring Failover 13
14
Is there any such thing as a
In Postgres automation? 14
15
YES 15
16
16
17
17
18
18
19
19
20
20
21
21
22
Setup and Initialization
22
23
EC2 Setup - variables 23
24
EC2 Setup - main.tf 24
25
EC2 Setup - main.tf optionals
25
26
Terraform apply
27
Terraform applied!
28
Installs Get the repository:
Installing postgres and supporting packages: postgresql_version: "9.6" 28
29
Re-installs 29
30
Customization $PGDATA Extensions 30
31
Tuning - postgresql.conf
Template files: Attributes: 31
32
Tuning - pg_hba.conf Template: 32
33
Tuning pg_hba.conf Values: File: 33
34
Ansible-playbook main.yml
37
Replication 37
38
Replication – recovery.conf
39
Ansible and replication
Groups: 39
42
Backups and restores - Setup
PITR: S3: 42
43
Backups 43
44
Restores 44
45
Configure PITR 45
46
WAL-e dependencies 46
47
Custom Monitoring
48
CloudWatch Monitoring
49
Failover Boolean parameter: promote_slave: False 49
51
Completely Automated Failover
51
52
Pgpool
53
PgPool
54
Watchdog
55
Watchdog
56
PgPool + Watchdog
57
Virtual IPs Elastic IP in AWS: 57
58
Pgpass file 58
59
Slave Rebuild Switch Base backup 59
60
pg_rewind Synchronize a PostgreSQL cluster with another copy of the same cluster, after the clusters' timelines have diverged 9.5 and above Superuser access wal_log_hints = 'on' or enable data checksums 60
61
Cronjobs 61
62
Useful Links https://github.com/payals/postgresql_automation
62
63
Questions? 63
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.