Webinar - Setup MySQL with Puppet

19
OlinData Webinar 2014 - https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF MIbMsBg/edit?usp=sharing Setup MySQL using Puppet Configuration management with puppet

description

Setup MySQL is simple, it becomes more simple and easy via puppet. With puppetlabs-mysql, you can take what was once a complex to manage, streamline into far simpler. Puppetlabs-mysql module, lets you both configure and manage your MySQL installation, plus manage MySQL resources such as users, grants, and databases. In this post, it will shows you how to easily setup MySQL server using puppet, as well as demonstrate how to quickly deploy a simple MySQL client.

Transcript of Webinar - Setup MySQL with Puppet

Page 1: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Setup MySQL using Puppet

Configuration management with puppet

Page 2: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Who am I?

• Krishna Prajapati, MySQL Engineer at Olindata

http://www.olindata.com/

Page 3: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Overview

• What is puppet (for those not aware)?• What is MySQL?

• Puppet Module selection

• Install puppet module

• Deploying MySQL client

• Deploying MySQL Server

• MySQL Management: database, user, grants

• Questions

Page 4: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

What is Puppet and why do we care?

• Configuration management software- http://www.olindata.com/blog/2014/08/puppet-master-agent-setup- http://www.olindata.com/blog/2014/09/setup-puppet-master-passenger-and-

apache-centos

• Scales very well (from 1 to 200k+ nodes)

• Multi-platform (windows, *nix, Mac OS, BSD)

• Commercially supported Open Source

• Infrastructure as code

Page 5: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

What is MySQL ?

• MySQL is a relational database management system(RDBMS)

• Opensource

• Multi-platform (windows, *nix, Mac OS, BSD)

• MySQL Flavours

- Percona

- MariaDB

• Central component of the widely used LAMP

Page 6: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

1. Puppet forge https://forge.puppetlabs.com/

2. Supported modules.

https://forge.puppetlabs.com/supported

3. Repositories included in Linux Distributions

Puppet Module selection?

Page 7: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Install puppet module[root@master]# puppet module search mysqlNotice: Searching https://forgeapi.puppetlabs.com ...NAME DESCRIPTION AUTHOR KEYWORDS puppetlabs-mysql Mysql module @puppetlabs mysql centos rhel ubuntu

debianalkivi-mysql Control MySQL server and allow database/user creation @alkivi debian mysql

database example42-mysql Puppet module for mysql @example42

example42 mysql ...devopera-domysqldb MySQL installation and configuration module@devopera ubuntu rhel centos mysqld

mysqljlondon-surrogate Puppet module to install Surrogate, an xtrabackup script @jlondon

redhat ubuntu debian mysql[root@master]#

Page 8: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Install puppet module[root@master]# puppet module install puppetlabs-mysqlNotice: Preparing to install into /etc/puppet/modules ...Notice: Downloading from https://forgeapi.puppetlabs.com ...Notice: Installing -- do not interrupt .../etc/puppet/modules└─┬ puppetlabs-mysql (v2.3.1)

└── puppetlabs-stdlib (v4.3.2)[root@master]#

Page 9: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

MySQL Client

Deploying mysql client is very straight forward.

/etc/puppet/manifests/site.ppnode 'client.olindata.com' {

class { 'mysql::client': }

}

Page 10: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

MySQL Server

Deploying mysql server is as simple as including mysql server

class.

/etc/puppet/modules/profile/manifests/mysql.pp

class profile::mysql {

class { '::mysql::server':root_password => 'strongpassword',override_options => { 'mysqld' => {

'max_connections' => '1024' } }}

}

Page 11: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

/etc/puppet/modules/role/manifests/database.pp

class role::database {

include profile::mysql

}

/etc/puppet/manifests/site.ppnode 'client.olindata.com' {

class { 'mysql::client': }}

node 'server.olindata.com' {include role::database

}

Page 12: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Creating mysql database

• MySQL Server alone is nothing without mysql database.

/etc/puppet/modules/profile/manifests/mysql.pp

mysql::db { 'mydb':

user => 'admin',

password => 'secret',

host => 'client.olindata.com ',

}

Page 13: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

MySQL User• We need to configure user and grants, so we are able to

provide permissions to the state of the table.

/etc/puppet/modules/profile/manifests/mysql.pp

mysql_user { '[email protected]':

ensure => 'present',

max_connections_per_hour => '100',

max_queries_per_hour => '200',

max_updates_per_hour => '200',

max_user_connections => '80',

}

Page 14: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

MySQL Grants• Grants are the privileges, provided to access the

database/tables

/etc/puppet/modules/profile/manifests/mysql.pp

mysql_grant { 'root@localhost/*.*':

ensure => 'present',

options => ['GRANT'],

privileges => ['ALL'],

table => '*.*',

user => 'root@localhost',

}

Page 15: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

• Other mysql flavours like MariaDB, Percona can be installed with the existing module ‘puppetlabs-mysql’

/etc/puppet/modules/profile/manifests/mysql.ppclass profile::mysql {

class { '::mysql::server':

package_ensure => 'present',

package_name => 'mariadb-server',

}}

MySQL Flavour Install

Page 16: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Upcoming training

• Puppet Fundamentals Training, Barcelona

Monday, November 24, 2014

• Puppet Fundamentals Training, Hyderabad

Monday, November 24, 2014

• Puppet Fundamentals Training, Pune

Monday, December 1, 2014

• Puppet Fundamentals Training, Singapore

Wednesday, December 17, 2014

Page 17: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Previous Webinars

Managing files with puppet

• by our CEO Walter Heck

• Link: https://www.youtube.com/watch?v=7fjwrOGRnSc

Page 18: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

We’re hiring!EU and Asia based trainers

[email protected]

Page 19: Webinar - Setup MySQL with Puppet

OlinData Webinar 2014 -https://docs.google.com/presentation/d/1lstjM9TXsBBi1ESZivy1ejIaSpVVvkcOmagF

MIbMsBg/edit?usp=sharing

Questions?

@krishna / @olindata

http://www.olindata.com

[email protected]

http://github.com/olindata