Running Galera MariaDB/Percona Cluster in Rackspace Cloud

In one of the recent cluster management requests our team was asked to provision and manage a Galera database cluster inside RackSpace Cloud based on "OnMetal General Purpose Medium" instances and the ClusterControl control panel.

The technical specifications of the setup were:

3 x OnMetal General Purpose Medium RackSpace instances
1 x Digital Ocean ClusterControl node

The choice of such setup was dictated by the fact the client's application servers were located in RackSpace Cloud and the single separate instance of MySQL was no longer capable of handling an increasing load on the database.

According to client's application benchmarks, the Galera cluster was going to provide a 7x performance increase of read operations and 3x performance increase of write operations compared to a single MySQL instance.

The RackSpace OnMetal instances are based on OpenStack Platform while promising Single-Tenant environment, easy scalability and instant provisioning.

On the other side, this means that compared to a dedicated server, the instance network interfaces are also virtualized and require some configuration changes to make ClusterControl + MariaDB/Percona setup work successfully.

Provisioning ClusterControl + MariaDB/Percona in RackSpace Cloud

1) RackSpace Firewall

Prior to starting cluster setup you are required to allow connections to and in between your RackSpace instance nodes in your instance firewall.

Let's consider that your RackSpace instances have the following Private Service IPs:

ClusterControl Instance (10.xxx.xxx.1)
Node1 (10.xxx.xxx.2)
Node2 (10.xxx.xxx.3)
Node3 (10.xxx.xxx.4)

You need to allow the following connections in the firewall:

ClusterControl >> Node1
ClusterControl >> Node2
ClusterControl >> Node3

Node1 >> Node2
Node1 >> Node3

Node2 >> Node1
Node2 >> Node3

Node3 >> Node1
Node3 >> Node2

So on each node you need to run the following command (Ubuntu):

sudo ufw allow from XXX.XXX.XXX.XXX

Where the xxx.xxx.xxx.xxx is the IP address of your node.

Follow the scheme shown above and allow firewall connections to and between your nodes before starting cluster setup.

2) RackSpace Network Interfaces

As mentioned above, one of the implications of OpenStack virtual machines, is that the network interfaces are also virtualized. This requires that you perform a few modifications to ClusterControl template files for Galera cluster to work out of the box.

During ClusterControl cluster configuration procedure, you need to untick the following options:

a) Disable Firewall
b) Disable AppArmor/SeLinux

If any of those are selected, your cloud instance may lose connectivity and you will not be able to connect to it and will be forced to recover.

The next thing to configure is the following:

ClusterControl uses template my.cnf files which are uploaded to each of your instances upon setup.

However, due to RackSpace network interfaces being virtualized, the Primary Network Interface in your instance appears to be an IPv6 interface.

This makes Cluster setup to fail as ClusterControl is unable to reach MariaDB on port 3306 as by default it won't be listening on it.

What you need to do, is open your ClusterControl Instance via SSH and edit the following template file:

/usr/share/cmon/templates/my.cnf.galera

And add the following line to it:

bind = 0.0.0.0

Like shown on the picture below:

Once this is done, launch cluster installation Job via ClusterControl as normal.

Once the job is finished, you should have a fully working MariaDB/Percona cluster in RackSpace Cloud.

For cluster management requests, contact WooServers DBA's team.

For ClusterControl requests, contact Severalnines.