MySQL InnoDB Cluster: Automated Installation with Puppet
Mysql 06-May-2017

MySQL InnoDB Cluster: Automated Installation with Puppet

We saw yesterday that the new MySQL Shell was out and how we could create a MySQL InnoDB Cluster manually using the Shell.

Today, I would like to show you how easy it is to create recipes to automate all the process. I have created a Puppet module that can be used as Proof-of-concept (You might need more features to use it in production, feel free to fork it).

The module can be found on this github repo.

When using Puppet, I really like to put all configuration in hiera.

Environment

We have 3 GNU/Linux servers: mysql1, mysql2 and mysql3.

We won’t install anything related to MySQL manually, everything will be handled by Puppet.

Nodes definition

So, we will define our classes and parameters in hiera.

We need to specify that our classes will be defined in hiera:

manifests/site.pp

hiera_include('classes')
node mysql1 {
}
node mysql2 {
}
node mysql3 {
}

This is the content of our hiera.yaml:

---
:backends:
  - yaml
:yaml:
  :datadir: /vagrant/hieradata
:hierarchy:
  - "%{::hostname}"
  - "%{::operatingsystem}"
  - common

We will have a common yaml file defining common parameters to all cluster nodes like the credentials and the seed, which point to the node we will use to bootsrap the group (see how to launch Group Replication).

common.yaml

---
 innodbcluster::mysql_root_password: fred
 innodbcluster::mysql_bind_interface: eth1
 innodbcluster::cluster_name: mycluster
 innodbcluster::grant::user: root
 innodbcluster::grant::password: fred
 innodbcluster::seed: mysql1

And finally every nodes need to have the class defined (it could also be defined in common.yaml) and the unique server_id:

mysql1.yaml:

---
classes:
- innodbcluster

innodbcluster::mysql_serverid:  1

mysql2.yaml:

---
classes:
- innodbcluster

innodbcluster::mysql_serverid:  2

mysql3:yaml:

---
classes:
- innodbcluster

innodbcluster::mysql_serverid:  3

And this is it !!

Easy isn’t it ?

The video below illustrates the full deployment of a MySQL InnoDB Cluster of 3 nodes using Puppet:

As usual, your feedback is important, don’t hesitate to submit bugs and features requests to https://bugs.mysql.com/ and if you like it, you can tell it too </p>
											</div>
					<div class=

Share This