Cloud PostgreSQL Automation Management with Ansible

Transcription

Cloud PostgreSQL Automation Management with Ansible
Cloud PostgreSQL Automation
Management with Ansible
Kenny Gorman
Chief 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
Ansible is
Simple systems automation/orchestration
framework
Easy to learn and use
Little overhead and footprint
Parallel execution
Ansible attributes
● Written in python
● Agentless/Daemon-less
● OpenSSH
● Idempotent
Ansible is
● Human readable
● Machine readable
Setup
● pip/yum/apt-get or repo
● SSH keys
● yaml files
Components
● Config: /etc/ansible/ansible.cfg
● Inventory: /etc/ansible/hosts
● Command line interface
● Modules
● Playbooks
Inventory
● /etc/ansible/hosts
Command Line
● Easy command line interface
Modules
● Core vs User
● Ansible Galaxy
Playbooks
● Template
Ansible + PostgreSQL
● Do I need Ansible?
● Database Provisioning
● Database Management
● DBA Sanity
Idempotent
Provisioning PG
…
PostgreSQL Modules
Core:
● postgresql_db
● postgresql_user
● postgresql_privs
● ...
User:
● Ansible Galaxy
● ansible_roles_pipelinedb
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
US-East
Private DC
LON
Ansible Management
Host
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.
Contact
@kennygorman
@rackspace
[email protected]
https://github.com/kgorman/ansible-roles_pipelinedb