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.


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:


node mysql1 {
node mysql2 {
node mysql3 {

This is the content of our hiera.yaml:

  - yaml
  :datadir: /vagrant/hieradata
  - "%{::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).


 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:


- innodbcluster

innodbcluster::mysql_serverid:  1


- innodbcluster

innodbcluster::mysql_serverid:  2


- 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 and if you like it, you can tell it too 😉

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

4 thoughts on “MySQL InnoDB Cluster: Automated Installation with Puppet

  1. Hello Lefred,

    Thanks for the great article, I just wanted to confirm that using Puppet it will also configure Group-replication as well for all Cluster nodes?

  2. Hi Lefred,

    Good Morning, Thanks for the great article.

    I’ve one question, In this article, the Puppet is also doing Group Replication configuration on this cluster?


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.