cloud postgresql automation management with...
TRANSCRIPT
Cloud PostgreSQL Automation Management with Ansible
Kenny GormanChief Technologist; Data
Rackspace
@rackspace @kennygorman
My Background
● Database Engineer, Developer, DBA, Architect, Founder, Chief
Technologist
● Oracle, MySQL, PostgreSQL, MongoDB, Apache Spark
● Ran a very large PG implementation at Hi5
● Contributed to early pg_reorg tooling
● Co-Founded ObjectRocket; MongoDB as a Service
You have more data than yesterday
Simple systems automation/orchestration framework
Easy to learn and use
Little overhead and footprint
Parallel execution
Ansible is
● Written in python
● Agentless/Daemon-less
● OpenSSH
● Idempotent
Ansible attributes
● Human readable● Machine readable
Ansible is
● pip/yum/apt-get or repo
● SSH keys
● yaml files
Setup
● Config: /etc/ansible/ansible.cfg
● Inventory: /etc/ansible/hosts
● Command line interface
● Modules
● Playbooks
Components
● /etc/ansible/hosts
Inventory
● Easy command line interface
Command Line
● Core vs User● Ansible Galaxy
Modules
● TemplatePlaybooks
Ansible + PostgreSQL
● Do I need Ansible?
● Database Provisioning
● Database Management
● DBA Sanity
Idempotent
Provisioning PG
…
Core: ● postgresql_db● postgresql_user● postgresql_privs● ...
User:● Ansible Galaxy● ansible_roles_pipelinedb
PostgreSQL Modules
Ops: Too many servers? Too little time? Too many mistakes?
● Ansible Management Host (or two)
● virtualenv/python/ansible
● git/github + your management code
● Inventory
● ssh key on every DB host
Ansible Management Host
US-EastPrivate DC
LON
Database Management
● start/stop
● pg_hba.conf hax
● upgrades
● user management
● schema uniformity
DB Management one liners
Are my DB machines up?
Is PG responding?
Make sure production indexes exist
Rolling new code/push to site
Are my DB getting smoked?
Triage
Whats is the slow query?
kill it
Gettin’ jiggy with Ansible
● pg_shard
● backups, cloning
● replica creation
● performance tuning
DBA Sanity
● Use modules wherever you can, if there are none, make one. Standardize.
● Git and Github are powerful when combined with Ansible.
● Use the cloud. Setup Dynamic Inventory.
● Use ad-hoc and playbooks in unison selecting the right time to use each.