Docker file/image to deploy Percona XtraDB Cluster 5.6 for dev/tests.


$ git clone
$ cd docker/percona-xtradb-5.6/centos
$ ./
$ ./ 3
$ ./
$ ssh root@ (root123)
$ mysql -uroot -proot123 -e "show status like '%wsrep%'"

Percona XtraDB Cluster 5.6 Dockerfile

# Percona XtraDB Cluster 5.6
# tag: latest
FROM centos:latest

RUN yum -y update
RUN echo 'root:root123' | chpasswd
RUN yum -y install openssh-server openssh-clients which
# unsafe


Vagrant box with Severalnines database cluster deployment scripts



Using Vagrant's Multi-VM environment makes launching several VMs to form a cluster painless and it's easy to quickly start playing with the various database clusters and our Severalnines's ClusterControl in a contained environment.

NOTE: The vagrant box file's size is 390MB and can take some time to download.
(Mar/14): ClusterControl 1.2.5, MySQL Cluster 7.3, Percona XtraDB Cluster 5.6, Codership 5.6, MongoDB 2.4.x
(May/13): MySQL Cluster 7.2.12, Codership Galera 5.5.29(Source distribution, wsrep_23.7.3.r3853), Percona XtraDB Cluster 5.5.30-30.2(Percona Server (GPL), Release 30.2, wsrep_23.7.4.r3843), Mongodb 2.4.x

This vagrant box comes with a set of Severalnines's database cluster deployment scripts to bootstrap the following:

  • 3 node Galera Cluster for MySQL (Codership and Percona builds).
  • 4 node MySQL Cluster. 2 SQL nodes, 2 MGM nodes and 2 Data nodes.
  • 1 sharded MongoDB Cluster with config servers and routers on 3 hosts.


Bootstrap Galera Cluster for MySQL

The script is available at github. Only tested with Ubuntu 12.04 and RHEL 6.3.

$ git clone
$ cd dbtools/galera
$ ./
!! Running this Galera bootstrap will wipe out any current MySQL installation that you have on your hosts !!
Continue? (Y/n):
Download Galera packages (Y/n):
What is your OS on your DB nodes [ubuntu|redhat]: (ubuntu)
Galera MySQL tarball ( 
Galera wsrep library ( 
Downloading packages...
Generate install scripts (Y/n):
MySQL install dir (/usr/local):
MySQL data dir (/var/lib/mysql):
InnoDB buffer pools size (1G):
InnoDB log file size (1G):
Where are your Galera hosts () [ip1 ip2 ... ipN]:
Name your Galera Cluster (my_galera_cluster):
SST method [rsync|xtrabackup] (rsync):
Writeset slaves/parallel replication (1):
Generate tarball (Y/n):
SSH user (alex):
SSH pub key (/home/alex/.ssh/
SSH port (22):
Creating tarball...
Deploy Galera (Y/n):
*** Bootstraping
*** Installing Galera wsrep provider
Killing any MySQL server running...
Do you want to secure your Galera cluster (y/N): y
Enter a new MySQL root password: root123
Securing MySQL...
Galera Cluster for MySQL installed...


Galera Cluster for MySQL with Amazon Virtual Private Cloud [4]

Previous: Create a VPC with Public and Private subnetsGalera Configurator and deploying Galera ClusterSetup Load Balancers and Web Servers


sysbench is a popular system peformance benchmark tool and has a database OLTP benchmark module which is popular among MySQL users. We are going to use it to create the default OLTP schema that is used and run a light test.

The purpose is not to really bench our newly deployed Galera cluster but to get some test data that we can pull out from our web servers that we setup previously.

Prepare sysbench schema and table

Logon o to your ClusterControl instance


Galera Cluster for MySQL with Amazon Virtual Private Cloud [3]

Previous: Create a VPC with Public and Private subnets, Galera Configurator and deploying Galera Cluster
Next: Test your AWS VPC Galera Cluster

Setup Internal and External Load Balancers

Next we are going to add two AWS load balancers, one internal for our database nodes and one external for our clients load balancing requests across our http servers.

You can opt to install HAProxy ( instead however you would need to handle failover for it.


Using Amazon’s elastic load balancers (ELB) we don’t need to worry about that however the ELBs are less configurable than HAProxy and lack other features as well.


Install the Galera http health check scripts


First on each Galera instances we are going to install a HTTP health check script that uses a Galera node’s state to determine whether the node should be classified as up or down.


Galera Cluster for MySQL with Amazon Virtual Private Cloud [2]

Previous: Create a VPC with Public and Private subnets
Next: Setup Load Balancers and Web ServersTest your AWS VPC Galera Cluster

Galera Configurator

Now that we have the EC2 instances prepared it’s time to run the Severalnines’s Galera Configurator and generate the deployment scripts to be run from the ClusterControl instance.

Go to and create a Galera deployment package. The wizard should be pretty self explanatory.

Select Amazon EC2 as the cloud provider and the OS used for your instances.


Galera Cluster for MySQL with Amazon Virtual Private Cloud

Next: Galera Configurator and deploying Galera ClusterSetup Load Balancers and Web ServersTest your AWS VPC Galera Cluster

In the next following posts we’ll deploy a multi-master synchronous MySQL Galera Cluster with Amazon’s VPC service. We’re going to create a public facing subnet for app/web servers and a private subnet for our database cluster.

The deployment will look similar to the below diagram.



Amazon’s VPC provides a secure environment where you can chose to isolate parts of your servers by having complete control of how to deploy your virtual networking infrastructure much like your own datacenter. 


The steps that we’ll go through are as following:


  1. Create a VPC with Public and Private subnets
  2. Define Security Groups (add rules later)
  3. Launch one instance for ClusterControl
  4. Launch three EBS optimized instances for the Galera/database nodes
  5. Format and mount an EBS volume (or RAID set) for each Galera nodes
  6. Create a Galera Configuration with Severalnines Galera Configurator 
  7. Deploy and bootstrap Galera Cluster
  8. Add an internal load balancer
  9. Add a MySQL user for the internal load balancer
  10. Add web server instances
  11. Add an external load balancer
  12. Test the VPC database cluster setup

At the end we have the following instances available on the public subnet (Note your IP addresses would be different):


  • 1 Elastic External Load Balancer, Elastic IP
  • 2 Web servers: IP, Elastic IP and IP, Elastic IP
  • 1 ClusterControl server: IP,  Elastic IP

and on the private subnet:


  • 1 Elastic Internal Load Balancer, IP
  • Galera Node 1, IP
  • Galera Node 2, IP
  • Galera Node 3, IP

In this example going forward we only deploy one private subnet however if you require a more fault tolerant setup you can for example create two private subnets for the database cluster one in each Availability Zone (AZ) which can protect you from single location failures within a single Amazon region.


There are a number issues that needs to be handled properly with a Galera cluster across two regions and/or AZs (which practically is two data centers). This will be addressed in a future post.



Opscode's Chef, MySQL Galera and Severalnines's ClusterControl

In the next following sections I'll be using Chef to deploy a MySQL Galera cluster on EC2 and then monitor and manage it using Severalnines's ClusterControl.

In the end we should have 5 nodes deployed:

* 1 Node with Chef Server and serving also as a Chef workstation using Chef v0.10.8
* 3 Nodes running MySQL Galera v5.5.23.6
* 1 Node running ClusterControl v1.1.28

The distribution used for the EC2 nodes in this post is Ubuntu Server 11.10 and the Chef version used is 0.10.8. 


Subscribe to galera