Upload
others
View
7
Download
0
Embed Size (px)
Citation preview
Best Practices for Running PostgreSQL in Production with Ansible TowerJonathan S. KatzDirector of Communications, Crunchy Data
2
• Director of Communications, Crunchy Data
• Previously: Engineering leadership in startups
• Longtime PostgreSQL community contributor
• Advocacy & various committees for PostgreSQL Global Development Group
• @postgresql + .org content
• Director, PgUS
• Conference organization + speaking
• @jkatz05
About Me
Market Leading Data Security
Crunchy Data is the leader in PostgreSQL security. Common Criteria certification and essential
security enhancements make Crunchy Certified PostgreSQL the trusted open
source PostgreSQL distribution for the enterprise.
Cloud Ready Data ManagementWhether deploying to public or private clouds, Crunchy Data
provides market leading, open source, Kubernetes-based
technology solutions, giving your team the choice and flexibility for how
you deploy your data.
Leader in Open Source Enterprise PostgreSQLCrunchy Data gives organizations the
technology, support, and confidence to enjoy the power and efficiency of open
source PostgreSQL.
Share your automation story
1. How did you get started with Ansible?I played around with Ansible many years ago when looking for ways to
automate provisioning development environments as well as managing the deployment tasks of production servers.
2. How long have you been using it?On and off for several years.
3. What's your favorite thing to do when you Ansible?I love taking a playbook designed for deploying a complicated
environment, setting up my inventory file, and then watching it run. It’s like…magic!
PostgreSQL:An Oldie but a Goodie
6
• The PostgreSQL relational database is over 30 years old and has been open source since 1996
• Open source like Linux: no single vendor; flexible license; no one can own PostgreSQL
• Recent PostgreSQL releases have brought it to feature parity with popular proprietary databases
• PostgreSQL's extensibility allows it to handle NoSQL workloads, accommodate developer language preferences, and provide full transaction safety and data integrity
• DB-Engines database ranking has PostgreSQL as the #1 growing database in both 2017 & 2018
The Rise of PostgreSQL
8
Running a Database in the Enterprise
9
What if I said…
…we could build this in one step?
Show Me
11
ansible-playbook -i \crunchy-ha-postgresql-active-single-data-center.inventory.yml \crunchy-ha-postgresql-active-single-data-center.playbook.yml
…this takes a bit of time to provision
We’ll come back later.
• Stateful workloads have one job: maintain state.• If your lose or corrupt your data, you may suffer severe business
continuity issues, e.g. no business to continue• Specific knowledge is required to perform state modification operations on a
stateful application. For example, with PostgreSQL, what happens when you• …provision a new cluster?• …take a backup?• …restore from a backup?• …promote a new replica?
• How can you ensure you do not corrupt your data?
Motivation: Databases + High-Availability ≠ Simple
1. Provision an environment
2. Install software
3. Initialize database directory ("initdb")
4. Modify "postgresql.conf" configuration file
5. Start the cluster
6. Add a user to the cluster
7. Add a database to the cluster that the user owns
8. Add authentication rules to "pg_hba.conf" file
9. Reload cluster configuration
Example: Provisioning a PostgreSQL Cluster
…now do this thousands of times.
Automation to the Rescue!
• Uses Ansible Automation to provide essential database-as-a-service functionality:
• Automated deployments
• Automated failover, promotion, & healing
• Advanced disaster recovery capabilities
• Load balancing & connection pooling
• Monitoring & alerting
• Uses all trusted, upstream open source components
Crunchy HA PostgreSQL
18
Why useCrunchy HA PostgreSQL?
19
Crunchy HA PostgreSQL: Open Source
Crunchy HA PostgreSQL:In Depth
21
Provisioning Workflow
• SELinux• Firewall rules• PostgreSQL• HA components• Disaster Recovery components• Monitoring
22
Failover & Healing
23
Disaster Recovery
24
Monitoring
Crunchy HA PostgreSQL:Environment Architectures
26
Single Data Center (or Single AZ)
Crunchy HA PostgreSQL: Built for Scale
27
Multi Data Center (or Multi-AZ)
Crunchy HA PostgreSQL: Built for Scale
28Multi-Continent
Crunchy HA PostgreSQL: Built for Scale
…what about that demo?
• We saw:
• An example Ansible inventory file for deploying Crunchy HA PostgreSQL
• A PostgreSQL cluster provisioned with one primary instance, two replicas, disaster recovery set up, monitoring set up, firewall rules set
• PostgreSQL operating normally
• A planned PostgreSQL outage where we switched over to a different primary.
• Unplanned downtime of a PostgreSQL primary node, and observed our cluster automatically heal
Crunchy HA PostgreSQL: Demo Recap
What’s Next?
• PostgreSQL can be used for mission-critical applications, Crunchy HA PostgreSQL automates this process.
• Come by the Crunchy Data booth (#600)for an in-depth demo! (and a hippo!)
• Come learn about the Crunchy PostgreSQL Platform that lets you deploy PostgreSQL anywhere from a single dashboard!
Crunchy HA PostgreSQL: What’s Next?
Thank YouJonathan S. Katz
[email protected] us at Booth #600!