We recently announced Percona ClusterControl supplied in partnership with Severalnines. This enterprise-grade cluster management and monitoring software is available with a Percona Support contract covering Percona XtraDB Cluster, MySQL Cluster, or MySQL Galera. In this blog post I am going to show you how to use Percona ClusterControl to to create a new 3-node cluster with Percona XtraDB Cluster.
Percona ClusterControl architecture
The software has three main parts:
- Percona ClusterControl UI: This is the web interface from where we can create new clusters and monitor and manage existing ones.
In this example hostname cc and IP 10.60.5.234.
- Controller (or cmon): We need one controller for each Percona XtraDB Cluster. The controller is placed between ClusterControl UI and the cluster itself. It connects to the cluster to gather information or run commands and send back info to the ClusterControl UI.
In this example hostname cmon and IP 10.60.5.233.
- Percona XtraDB Cluster: This is the cluster itself. We can create a new one or manage an existing one.
In this example hostnames xtradb1, xtradb2, xtradb3 and IPs 10.60.5.235-237.
Installation of Percona ClusterControl UI
First we need to install the Percona ClusterControl UI. We provide a link to the installation script in Percona’s customer portal. We just need to download the script and run it as root in the server designed for Percona ClusterControl UI.
The installer will do everything for us. It will download Percona ClusterControl UI and all the dependencies needed from distribution’s repositories. It will also install MySQL, PHP5 and Apache. When the installation process finishes it will show this message:
Initial setup complete. To finalize the installation open your web browser
and go to this URL, http://10.0.2.15/install to finalize the installation.
Public/external IP => http://x.x.x.x/install
NOTE: Detected more than one IP: 10.0.2.15 10.60.5.234
Now we can access the Percona ClusterControl UI from the web interface and continue the installation process there. The installer will check if the server meets all the pre-requisites and it will ask some extra details to finish the installation:
- MySQL username and password: This is the MySQL server the install-cc.sh installed for us and where the Percona ClusterControl UI will store its own information.
- Your name, logging e-mail and password: This is important, because this is the admin account for the Percona ClusterControl UI. The e-mail is also very important, because it is where we will receive new customised package installations created by the tool as we will see later on.
If everything is correct click on “Install” and it will show us the following notice:
After accepting the notice, Percona ClusterControl will show us the login screen.
This is the main page still with no clusters monitored.
Creating our first Percona XtraDB Cluster
The next step is to install our cluster. It can be done from the web interface. We just need to click on “Create Database Cluster” button. The cluster creation wizard will start. First we need to choose which kind of configuration we want to deploy. We will choose “Galera Cluster for MySQL“:
The next step in the wizard is to provide the info about the kind of Galera Cluster we want and the network info about the nodes.
It is divided in two different sections:
- Settings: Here we have to make several decisions and provide info about our cluster nodes. By default Percona XtraDB Cluster will be deployed. We will need to provide extra info like the IPs, Linux distribution, hardware information and cluster configuration parameters.
- Cluster Control Node: Here we need to configure the controller or cmon for this cluster. The controller node is the one that will connect to all our cluster nodes, install software and monitor them. Therefore, this control node needs to have access with SSH to all other nodes. That’s the reason we can upload an SSH private key. It is recommended that all 5 servers can connect to each other with passwordless authentication (root user) using an SSH key.
Now we have two options. Just deploy the cluster from the web interface or generate an installation package. We are going to use the second option so we can see what it does under the hood. When we click the “Generate Package” it will send us a tar.gz to our e-mail address.
Control Node and Cluster deployment:
We need to upload the package to the control node and run the installation script. It will check the connectivity, firewall ports and the SSH keys:
root@cmon:~/s9s-galera-percona-2.4.0/mysql/scripts/install# bash ./deploy.sh 2>&1 |tee cc.log
Checking EC2 Keypair:
Key pair found
Firewalls must accept 4567 (galera), 4567+1 (galera IST), 22 (ssh), (rsync), 3306 (mysql), ping (icmp).
Then it will connect to the three cluster nodes and start the installation process using apt-get or yum. Packages like xtrabackup, Percona XtraDB Cluster or netcat will be installed to ensure normal cluster operations.
10.60.5.233: scp -P22 ../../repo/RPM-GPG-KEY-percona firstname.lastname@example.org:/root/s9s_tmp/RPM-GPG-KEY-percona[ok]
10.60.5.235: Executing 'gpg --import /root/s9s_tmp/RPM-GPG-KEY-percona' [ok]
10.60.5.235: Executing '/bin/sh -c 'gpg -a --export CD2EFD2A | apt-key add -'' [ok]
10.60.5.235: Executing '/bin/sh -c 'echo "deb http://repo.percona.com/apt wheezy main" >> /etc/apt/sources.list'' [ok]
10.60.5.235: Executing '/bin/sh -c 'echo "deb-src http://repo.percona.com/apt wheezy main" >> /etc/apt/sources.list'' [ok]
10.60.5.235: Executing 'apt-get -q -y update' [ok]
10.60.5.235: Executing 'LC_ALL=en_US.utf8 DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::='--force-confnew' -y -q install percona-xtradb-cluster-galera-2.x percona-xtradb-cluster-client-5.5 percona-xtradb-cluster-server-5.5 percona-xtrabackup' [ok]
All the Percona XtraDB Cluster process is automatic. When the installation of nodes is finished it will start to install the Control Node package and its dependencies (apache, PHP and MySQL). After that, the process has finished:
galera : 10.60.5.237 [ up]
galera : 10.60.5.236 [ up]
galera : 10.60.5.235 [ up]
Installation completed in 618 seconds
* CONGRATULATIONS *
You have now installed one of the most advanced db infrastructures available.
Open your browser to http://10.60.5.233/cmonapi
Logon with your email address and password.
This is your ClusterControl API token, xxxxxxxxxxxxxxxxxxxxxxxxxx, keep it for safekeeping if you need to (re)register your cluster again.
We need to open the URL and insert the API token there:
After that we need to “connect” the Control Node with the Percona ClusterControl UI:
And that’s all. We have Percona ClusterControl installed and a new Percona XtraDB Cluster in our infrastructure that we can monitor and manage from a web interface.
Percona ClusterControl is a really useful and user-friendly tool to manage and monitor our clusters. We can use it to create new clusters as we have seen here or to manage already existing clusters. I will write a second blog post explaining how to put our already in production Percona XtraDB Cluster under Percona ClusterControl management.