MySQL Cluster is, without doubt, the most interesting MySQL product Oracle offers to the people out there.
It’s the flagship, the holy grail, based on the knowledge and technology developed doing our well known MySQL Server.

I’m not going to go through why MySQL Cluster is so great, that you can find anywhere.
I’m going to show how to use the new MySQL Cluster Manager (aka MCM) to easy and quick setup your Cluster.

If you ever setup a cluster, you’d know that “easy” and “quick” are not the first association one have when thinking about MySQL Cluster. Let’s face it; Cluster is pain to setup…
It has millions of parameters to play with, each has to be set on all nodes, you have to be very careful when you change things and if, by any chance, you have to upgrade your Cluster…. Than, well…. May the force be with you.

Just imagine you have 24 nodes cluster, with 8 data groups – you have to stop, upgarde, check settings and start each node at the specific order to keep your cluster running. It can be done, but it’s gonna take you a long excruciating painful hours. It’s not for the faint of heart.

That’s exactly where MySQL Cluster Manager gets into the picture!

If you take special pleasure staring at black terminal windows for hours just to finally get your prompt back without error and with no SMS saying: “YOU’RE FIRED!”, stop reading. this post is ot for you.

MySQL Cluster Manager is an application that does one thing and one thing only: it installs and manages the proper configurations of cluster(s).
That said, it’s not replacing by any form of shape the Cluster Management node which responsible for the correct operations of the nodes. Actually, MCM will setup those nodes as well, as you’ll see soon.

Extract the Cluster package itself. Notice: you’re not installing it, you just extracting it so the manager can use it

tar -zxvf /mysql-cluster-com-7.1.14-linux-i686-glibc23.tar.gz

Let’s have a look what we have at /opt

ls -la /opt
mcm
mysql-cluster-com-7.1.14-linux-i686-glibc23

Setting up the agent

As you can see from the picture, the agent has to run on all the servers (nodes). Actually, that’s the only time you’ll have to do something on all the node manually. From here on, the agent will take care of things for you.
Not only that, the agents are synchronising between themselves, so you can connect to any of the nodes with the manager and control the whole cluster(s).

Edit: from version 1.1.1(GA) there’s no need to edit the mcmd.ini file.
You can if you want, based on the man page.

Create group and user for the manager daemon to run under (it cannot be run as root) and make sure the directory owned by this user

If something wrong and it’s not running, check the logs in /opt/mcm/mcmd.log

Now do the same for each of the hosts (from the /etc/hosts part, just below the picture).

Connecting to the Manager

Connecting to the manager is achieved by using a regular MySQL console application directed to the Manager port that we set before (default 1862). You can install MySQL client or just use the console we extracted with the cluster package.
Default user is: admin, password: super

You should now see, unsurprisingly, the same console you’re used to with MySQL. To make sure you are actually within the Manager console, run the following command (the mcm> prompt doesn’t says anything… We made that happen…)

list commands;

That will show you the list of commands (duh…) that the Manager accept. It worth mentioning that using command –help will provide you with full details of the command.

Getting and Setting cluster parameters

Before we start the cluster, we should set the parameters that applies to it. Some cannot be changed after the first start, such as NoOfReplicas. Most will only required restart of the cluster.
The way to see what are the current parameters is using the get command. The syntax, once again, pretty simple:

Starting the cluster

Ok, it’s time to start the cluster… Note the use of the flag -B to start the cluster in background. If you don’t use it – the prompt will be waiting for the cluster to start (or fail) without an option to see what’s going on (unless you connect with another console).

Some very basic games with cluster

Ok, we did all that for…. what?
Haa, yes…. To have a fully redundant, super fast, ACID compliment database. It’ll be hard to show the performance of a cluster, as it’s running on a virtual machines, but we can definitely see redundancy.

Let’s create NDB database to play with. On one of the mysqld machines (cA on port 3306 or Cb on port 3307 as we changed that before):

Now let go and shutdown one of the datanodes.
Note that since we have 4 data nodes and 2 data groups (NoOfReplicas=2), we can kill up to 2 datanodes from each group and the cluster suppose to say alive.
Two servers (only one virtual host: “cD”) are not failing

That looks pretty live to me… The cluster still working even though two data nodes are dead.

Let’s restart the server and see what will happen.
All I’m going to do is to re-run the agent application on the failing server.
If it was a totally new fresh server, I also had to go through the initial process of un-packing the cluster package, agent and setup the hosts file, making sure the new server has the same network IP and hostname as the old one.

Rolling restart

Rolling restart is a restart of all nodes, one by one while keeping the cluster active while doing that. Mainly when you have changed setting of the cluster which requires restart of the nodes, but you need the keep it running while it’s applying the changesEdit: Cluster Manager take care of restarting the nodes after applying new settings, if restart is required. That means that manual rolling restart is rarely used. Only if you have good reason…

Cluster software Upgrade

Upgrade of the cluster can be done quite easy as well. Watch Andrew’s flash to see how.

Conclusion

MySQL Cluster Manager makes installing, configuring, managing & monitoring much easier than ever before.
It’s an easy tool that can be easily scripted and it’s only make sense to use it if you’re running cluster in production, where cluster has to keep it’s 99.999% uptime.

One Response to “MySQL Cluster Manager hands on”

While MCM is part of the commercial MySQL Cluster Carrier Grade Edition, users can download and use MCM to build their own cluster, without obligation, for 30 days.
Go to the MySQL Cluster Manager trial of the resources section to get access to MCM:http://mysql.com/products/cluster/mcm/