ansible for large scale deployment

22
Large Scale MySQL Deployment Using Ansible Karthik .P.R Lead MySQL DBA – Yahoo! (26-06-2015)

Upload: remote-mysql-dba

Post on 14-Aug-2015

987 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Ansible for large scale deployment

Large Scale MySQL Deployment Using Ansible

Karthik .P.R

Lead MySQL DBA – Yahoo!

(26-06-2015)

Page 2: Ansible for large scale deployment

About : Karthik.P.R

• 5+ years of experience as a DBA• Currently : Lead DBA at Yahoo!• Current Focus : MySQL Tools and Automation.• Student : M.Sc ( FOSS )• Blogger : remotemysqldba.blogspot.in• Contact :

• Email : [email protected]• Linkedin : https://in.linkedin.com/in/prkart• Twitter : @prkart• Slideshare : https://www.slideshare.net/prkart

Page 3: Ansible for large scale deployment

Current Operation Model

• Deploy using SSH login.• Custom shell scripts or .bat file.• Manual Installation.• Operation run books.• Scheduled jobs• Add node to monitoring.

Page 4: Ansible for large scale deployment

Central Configuration Management

Need for Central Configuration Management ?

Page 5: Ansible for large scale deployment

Central Configuration Management

Need for Central Configuration Management ?

• Large scale deployment• Configuration changes• User management • Avoid manual intervention• Track changes

Page 6: Ansible for large scale deployment

Central Configuration Management

General Architecture

Page 7: Ansible for large scale deployment

Available Tools

• Ansible• Chef• Puppet• Salt• CFEngine• Vagrant

Page 8: Ansible for large scale deployment

Available Tools

• Ansible :

GPL V3,Python , agent less , Playbook ( YAML )

• Chef :

Apache license ,Ruby/Erlang , Cookbooks ( Ruby )

• Puppet :

Apache license ,Ruby, Manifests ( Puppet Language )

• Salt :

Apache license ,Python, States ( YAML )

Page 9: Ansible for large scale deployment

Why Ansible ?

• Agent less • Simple and more readable• Uses SSH protocol• Push based ( Pull is also possible )• idempotent• Orchestration

Page 10: Ansible for large scale deployment

Software Requirements

• Control Machine ( Unix based )• Python 2.6 or 2.7• Ansible• pip

• Managed nodes

• Python 2.5• Python-simplejson• libselinux-python ( For SELinux )• Native Power Shell ( Windows )

Page 11: Ansible for large scale deployment

Terminology

• Playbook : Collection of plays. They define the configuration and Orchestration.

• Inventory : List of hosts and host groups.

• Modules : Can be any language execute remotely.

• Play : Is the minimal mapping for set of hosts.

• Facts : Data collected from target hosts.

Page 12: Ansible for large scale deployment

Ansible Architecture

Page 13: Ansible for large scale deployment

Configuration

• Config File

• ANSIBLE_CONFIG Env variable• ./ansible_config • ~/.ansible_config• /etc/ansible/ansible.cfg

• Inventory • /etc/ansible/hosts• (OR) Dynamic Inventory

Page 14: Ansible for large scale deployment

Configuration

• Inventory • Hosts• Groups• Sub groups• Group configs

Playbooks has their own inventory list in INI format

Page 15: Ansible for large scale deployment

Configuration

• Sample Inventory

[master]

sports.db1.com

finance.db1.com

[slave]

sports.db2.com

finance.db2.com

[dbserver]

master

slave

Page 16: Ansible for large scale deployment

Modules

MySQL Modules:

• mysql_replication• mysql_user• mysql_variables• mysql_db

# Set read_only variable to 1- mysql_variables: variable=read_only value=1 login_host=db2.finance.com

Page 17: Ansible for large scale deployment

Sample YAML

Page 18: Ansible for large scale deployment

MySQL Use cases

• Version Specific MySQL Config

Eg) Enable GTID on MySQL 5.6• Hardware Based Tuning• Property based variables• User configuration• Backup set up• Monitoring setup using Nagios• Cronjob or schedulers

Page 19: Ansible for large scale deployment

Best Practices

• Use Version Control for Playbooks.• Headless user for deployment.• Use push based method.• YAML needs a good editor ( Atom, Notepad ++ , etc )

Page 20: Ansible for large scale deployment

To get started

• Ansible galaxy make things more simple

Page 21: Ansible for large scale deployment

More Reading

• Ansible Official

• Slideshare

• Books : Ansible Up & Running.

Page 22: Ansible for large scale deployment

Thanks !!!