Utilizing Ansible to Manage a Highly Available MySQL Environment



Similar documents
Ansible. Configuration management tool and ad hoc solution. Marcel Nijenhof

Ansible. swiss army knife orchestration

Infrastructure as data with Ansible for easier Continuous Delivery

Oracle Net Service Name Resolution

Ansible in Depth WHITEPAPER. ansible.com

Ansible for AWS. A simple way to provision and manage your Amazon Cloud infrastructure. Yan Kurniawan

Continuous Integration In challenging environments w/ Ansible. PyCon5 Italy, Cesare Placanica

Alfresco Enterprise on AWS: Reference Architecture

XpoLog Competitive Comparison Sheet

ABRAHAM ARCHITECTURE OF A CLOUD SERVICE USING PYTHON TECHNOLOGIES

Server Virtualization with Windows Server Hyper-V and System Center

Pertino HA Cluster Deployment: Enabling a Multi- Tier Web Application Using Amazon EC2 and Google CE. A Pertino Deployment Guide

Outline. MCSA: Server Virtualization

DIY Device Cloud Documentation

depl Documentation Release depl contributors

Data Backup and Restore (DBR) Overview Detailed Description Pricing... 5 SLAs... 5 Service Matrix Service Description

How to install/configure MySQL Database

MySQL Security: Best Practices

Server-Virtualisierung mit Windows Server Hyper-V und System Center MOC 20409

Scalable Architecture on Amazon AWS Cloud

Server Virtualization with Windows Server Hyper-V and System Center

KonyOne Server Installer - Linux Release Notes

Automated Configuration of Open Stack Instances at Boot Time

Building a Kubernetes Cluster with Ansible. Patrick Galbraith, ATG Cloud Computing Expo, NYC, May 2016

Architecture and Mode of Operation

Installation Guide. Copyright (c) 2015 The OpenNMS Group, Inc. OpenNMS SNAPSHOT Last updated :19:20 EDT

Assignment # 1 (Cloud Computing Security)

Getting Started with Attunity CloudBeam for Azure SQL Data Warehouse BYOL

MySQL Strategy. Morten Andersen, MySQL Enterprise Sales. Copyright 2014 Oracle and/or its affiliates. All rights reserved.

Architecture and Mode of Operation

Integrating SAP BusinessObjects with Hadoop. Using a multi-node Hadoop Cluster

Citrix XenServer Backups with Xen & Now by SEP

DevOps. Building a Continuous Delivery Pipeline

Architecture Overview

ITG Software Engineering

HIPAA Compliance Use Case

IAN MASSINGHAM. Technical Evangelist Amazon Web Services

Source Code Management for Continuous Integration and Deployment. Version 1.0 DO NOT DISTRIBUTE

Timofey Turenko. Kirill Krinkin St-Petersburg Electrotechnical University

Zero-Downtime MySQL Backups

Ansible Tower User Guide

When flexibility met simplicity: The friendship of OpenStack and Ansible

The path to the cloud training

Server Virtualization with Windows Server Hyper-V and System Center

SkySQL Data Suite. A New Open Source Approach to MySQL Distributed Systems. Serge Frezefond V

Server Virtualization with Windows Server Hyper-V and System Center

Cloud Backup Service Service Description. PRECICOM Cloud Hosted Services

Course 20533: Implementing Microsoft Azure Infrastructure Solutions

Oracle Database Cloud Services OGh DBA & Middleware Day

Database SQL Server SERVER. Framework. Templates. Data. Exchange OS

1Z Oracle Weblogic Server 11g: System Administration I. Version: Demo. Page <<1/7>>

Server Virtualization with Windows Server Hyper-V and System Center

CloudPassage Halo Technical Overview

Using Apache Derby in the real world

Jenkins Slave Cloud with Apache Mesos. Klaus Azesberger Reinhard Kiesswetter Infonova GmbH

Server Virtualization with Windows Server Hyper-V and System Center

Implementing Microsoft Azure Infrastructure Solutions

Backup and Restore with 3 rd Party Applications

Implementing Microsoft Azure Infrastructure Solutions 20533B; 5 Days, Instructor-led

Python and Google App Engine

ArcGIS for Server in the Cloud

Moving to Plesk Automation 11.5

CloudPassage Halo Technical Overview

Course 20533B: Implementing Microsoft Azure Infrastructure Solutions

WHAT S NEW IN SAS 9.4

HDFS Cluster Installation Automation for TupleWare

Migration and Building of Data Centers in IBM SoftLayer with the RackWare Management Module

Chapter 9 PUBLIC CLOUD LABORATORY. Sucha Smanchat, PhD. Faculty of Information Technology. King Mongkut s University of Technology North Bangkok

Developing Plugins for Cloud Scale

ArcGIS for Server in the Amazon Cloud. Michele Lundeen Esri

Preparing for the Installation

Building and Managing a Standard Operating Environment

Availability for the modern datacentre Veeam Availability Suite v8 & Sneakpreview v9

Citrix XenDesktop Backups with Xen & Now by SEP

FioranoMQ 9. High Availability Guide

Red Hat Enterprise Linux OpenStack Platform 7 OpenStack Data Processing

Copyright 2014 SolarWinds Worldwide, LLC. All rights reserved worldwide. No part of this document may be reproduced by any means nor modified,

ArcGIS for Server: In the Cloud

Cloudera Manager Training: Hands-On Exercises

Course 10751A: Configuring and Deploying a Private Cloud with System Center 2012

SQL Server Training Course Content

Deploying Cloudera CDH (Cloudera Distribution Including Apache Hadoop) with Emulex OneConnect OCe14000 Network Adapters

MS 10751A - Configuring and Deploying a Private Cloud with System Center 2012

Centrify Identity and Access Management for Cloudera

PAYMENTVAULT TM LONG TERM DATA STORAGE

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

POPI Cloud Backups. Overview. The Challenges

CDH installation & Application Test Report

MySQL: Cloud vs Bare Metal, Performance and Reliability

Implementing Microsoft Azure Infrastructure Solutions

Of Pets and Cattle and Hearts

Windows Server. Introduction to Windows Server 2008 and Windows Server 2008 R2

mypro Installation and Handling Manual Version: 7

Content Distribution Management

Dataworks System Services Guide

Transcription:

Utilizing Ansible to Manage a Highly Available MySQL Environment MYSQL ANSIBLE - MHA Presented by ALKIN TEZUYSAL, MIKLOS SZEL April 14 2015

About : Alkin Tezuysal u Currently Team Manager, Pythian u 20 years experience in RDBMS world u Acted as Sr. DBA to Supervisor roles u Previously worked u ebay Intl, Supervisor u Bank of America, Sr. DBA u AT&T, Sr. DBA u How to Contact: u Email: tezuysal@pythian.com u Twitter: @ask_dba u Linkedin: tr.linkedin.com/in/askdba/en 2

About : Miklos Mukka Szel u Currently MySQL Consultant, Pythian u 10+ years experience System and Database world u Acted as Sr. DBA, Sr. Ops, Developer u Previously worked u Own startup u ISP u Walt Disney u How to Contact: u Email: szel@pythian.com u Twitter: @42mukka u Linkedin: hu.linkedin.com/in/miklosszel/en 3

Ansible in a Nutshell ü Simple ü Agentless ü Easy to manage ü Idempotent ü 100% Python ü Configuration management ü Uses ssh For more: http://docs.ansible.com/intro_installation.html 4

MHA in a Nutshell ü Automated Master failover ü Interactive Master failover ü Non-interactive Master failover ü Online Master switching ü Easy to configure ü Open Source HA utility For more: https://code.google.com/p/mysql-master-ha/ 5

MySQL in a Nutshell ü De-facto standard for web, e-commerce and startup companies ü Easy to manage and use ü Why we all are here For more: http://www.oracle.com/us/products/mysql/ overview/index.html 6

Back to Ansible 1) Installation 2) Configuration 3) Best practices 4) Demo on how to use with MySQL-MHA 7

Installation - I Ø Verify your version of Python, install pip: $ sudo easy_install pip Ø Add Python modules: $ sudo pip install paramiko PyYAML Jinja2 httplib2 Ø Install Ansible via pip : $ sudo pip install ansible Ø Install Ansible via yum: # install the epel-release RPM if needed on CentOS, RHEL, or Scientific Linux $ sudo yum install ansible Ø On OSX : $ brew install ansible For more: http://docs.ansible.com/intro_installation.html 8

Installation - II Ø Set hosts to test: $ echo "127.0.0.1" > ~/ansible_hosts $ export ANSIBLE_HOSTS=~/ansible_hosts Ø Test your installation: $ ansible all - m ping - - ask- pass SSH password: 127.0.0.1 success >> { "changed": false, "ping": "pong" } 9

Configuration- I Ø Setup Config file: ANSIBLE_CONFIG (an environment variable) ansible.cfg (in the current directory) ansible.cfg (in the home directory) /etc/ansible/ansible.cfg For more: http://docs.ansible.com/intro_configuration.html 10

Configuration- II Inventory file : Define hosts and groups Default file : /etc/ansible/hosts [databases] 54.167.36.187 mysql_role=master server_id=1 23.22.187.189 mysql_role=slave server_id=2 backup_src=54.167.36.187 54.87.24.162 mysql_role=slave server_id=3 backup_src=54.167.36.187 [system] 54.167.36.187 mycnf=plsc_s1 mysql_role=master nickname=dev- plsc- m 23.22.187.189 mycnf=plsc_s2 mysql_role=slave nickname=dev- plsc- s1 54.87.24.162 mysql_role=slave nickname=dev- plsc- s2ample: Dynamic Inventory : AWS EC2 External Inventory Script (ec2.py) # ansible- playbook - i "localhost," ansible/playbooks/launch_ec2.yml # /ec2.py - - list For more: http://docs.ansible.com/intro_inventory.html, http://docs.ansible.com/intro_dynamic_inventory.html#example-aws-ec2-external-inventory-script 11

Configuration- III Playbooks YAML format One or more plays in a list Executes tasks Supports hosts Supports roles Supports tags Supports groups Supports remote_user Provides idempotent runs against host groups Uses ansible modules Example: $ ansible- playbook playbook.yml - - list- hosts $ ansible- playbook playbook.yml - - list- tasks $ ansible- playbook playbook.yml - f 10 $ ansible- playbook playbook.yml - - tags=setup,configure - - list- tasks $ ansible- playbook playbook.yml - - tags=always,setup,configure - - list- tasks For more: http://docs.ansible.com/playbooks_intro.html 12

Configuration- IV Ansible built-in modules Providing robust functions Runtime or via playbook Can be customized or developed Example: Adhoc $ansible i hosts.yml dbservers - m service - a "name=mysqld state=started" $ansible i hosts.yml webservers - m command - a "/sbin/reboot - t now" Playbooks - name: reboot the servers command: /sbin/reboot - t now For more: http://docs.ansible.com/modules.html 13

Configuration- IV (cntd) MySQL Modules mysql_db à Add remove databases to remote hosts mysql_replication à Manage MySQL replication mysql_user à MySQL user management mysql_variables à Manage global variables Others Modules Mongodb, postgresql Package managers (yum, apt) Service File Template For more: http://docs.ansible.com/list_of_database_modules.html#mysql 14

Best practices Ansible Vault ansible-vault Key management (aes256 encryption) Create new encrypted vault $ ansible-vault create system.yml Editing encrypted key $ ansible-vault edit system.yml Rekeying $ ansible-vault rekey system.yml Encrypt unencrypted files $ ansible-vault encrypt system.yml Decrypt encrypted files $ ansible-vault decrypt system.yml Viewing decrypted files $ ansible-vault view system.yml Playbook integration $ ansible-playbook -i clusters/test setup.yml --ask-vault-pass File integration $ ansible-playbook -i clusters/test setup.yml --vault-password-file ~/.vault_pass.txt For more: https://docs.ansible.com/playbooks_vault.html 15

Best practices Templates Use of templates # MHA cluster configuration # generated by Ansible, do not modify by hand. # config for cluster: {{cluster_id}} [server default] user={{my_mha_user}} password={{my_mha_pass}} repl_user={{my_repl_user}} repl_password={{my_repl_pass}} ssh_user=root manager_workdir=/var/log/masterha/{{cluster_id}} remote_workdir=/var/log/masterha/{{cluster_id}}... #my.cnf innodb_buffer_pool_size = {{ (ansible_memtotal_mb * 70 / 100) round int }}M For more: https://github.com/mszel-pythian/ansible_mha/blob/master/roles/common/templates/etc/cluster.cnf 16

MySQL Use Cases Installation and deployments MySQL configuration management User management DB task management Backup and Restores Bootstrapping Database change management Database pool management Orchestration with other services 17

Ansible Workflow 18

19

Demo https://github.com/mszel-pythian/ansible_mha Show configuration files and sample setup Demonstrate launching ec2 mysql instances configuring MHA and failing over with Ansible SYSTEM SETUP(common role) Fine tune system variables (sysctl) Install system packages and mha Create configuration files based on templates Create users based on public keys under files/users MYSQL PART(mysql role) Install mysql binaries Create my.cnf based on template (exception handling) Install mysql users (replica,system users, monitor app users), remove passwordless users Build slave automatically with xtrabackup streaming 20

Demo (cntd) roles/common/tasks/common_mha.yml - yum: name=/root/mha4mysql- manager- 0.56-0.el6.noarch.rpm state=present when: "mysql_role == 'mha_manager' TASK: [common yum name=/root/mha4mysql- manager- 0.56-0.el6.noarch.rpm state=present] *** skipping: [54.163.66.141] skipping: [54.161.225.49] skipping: [54.166.98.113] changed: [54.157.195.13] [ ] roles/mysql/tasks/main.yml: - include: mysql_slave_xtrabackup.yml when: "bootstrap_enabled and mysql_role!= 'master'" tags: slave TASK: [mysql Streaming the backup from {{ backup_src }} to {{ inventory_hostname }}] *** skipping: [54.161.225.49] changed: [54.166.98.113] changed: [54.163.66.141]

Credits Q & A Derek Downey @derek_downey Principal Consultant, Pythian Rick Pizzi DBA, Bravofly Narcis Pillao Devops, edreams Contact us: Alkin Tezuysal : @ask_dba, tr.linkedin.com/in/askdba/en Mukka Szel : @42mukka, hu.linkedin.com/in/miklosszel/en 22

ABOUT PYTHIAN 10,000 Pythian currently manages more than 10,000 systems. 350 Pythian currently employs more than 350 people in 25 countries worldwide. 1997 Pythian was founded in 1997 200+ leading brands trust us to keep their systems fast, relaible, and secure Elite DBA & SysAdmin workforce: 7 Oracle ACEs, 2 Oracle ACE Directors, 5 Microsoft MVPs, 1 Cloudera Champion of Big Data, 1 Datastax Platinum Administrator More than any other company, regardless of head count Oracle, Microsoft, MySQL, Hadoop, Cassandra, MongoDB, and more. Infrastructure, Cloud, SRE, DevOps, and application expertise Big data practice includes architects, R&D, data scientists, and operations capabilities Zero lock-in, utility billing model, easily blended into existing teams.