CentOS: Integrate ClusterControl into Existing MySQL Galera Cluster

I am going to integrate Severalnines’s ClusterControl into my existing MySQL Galera cluster which currently being used by our development team. ClusterControl allow us to manage, control and monitor our MySQL cluster from single point.

Actually, you can use their installer script to install a complete MySQL Galera suite as refer to this post.

In this case, I already have a set of MySQL Galera Cluster running for our development team which has been installed using the hard way as similar to this post. So my mission is to integrate this great tool into my existing MySQL Galera cluster.

Requirement

  • 3 servers which already synced into a Galera cluster
  • 1 server for ClusterControl
  • No firewall and SELINUX enabled
  • The value inside /etc/hosts for all servers should be as below:
192.168.1.201    galera1.local galera1
192.168.1.202    galera2.local galera2
192.168.1.203    galera3.local galera3
192.168.1.210    clustercontrol.local clustercontrol

ClusterControl Server

1. ClusterControl required all servers to use passwordless SSH. We need to setup the SSH key to all of Galera nodes. Lets generate the key as user root:

$ ssh-keygen -t rsa

Notes: Just accept default value by pressing Enter until finish.

2. Copy the public key that we just created to all Galera nodes:

$ ssh-copy-id -i ~/.ssh/id_rsa root@galera1
$ ssh-copy-id -i ~/.ssh/id_rsa root@galera2
$ ssh-copy-id -i ~/.ssh/id_rsa root@galera3

Notes: You may need to enter the root password of the destination server each time you execute the command.

3. Download the bootstrap script from Severalnines page here. This script will help us a lot for this integration:

$ cd /usr/local/src
$ wget http://severalnines.com/downloads/cmon/cc-bootstrap-1.1.34.tar.gz
$ tar -xzf cc-bootstrap-1.1.34.tar.gz

4. Before we start, we might need to make sure several package is installed using yum. Sudo and crond are required:

$ yum install cronie sudo -y

5. Run the bootstrap script for controller. This will configure and install all required package in order to run ClusterControl:

$ cd cc-bootstrap-1.1.34
$ bin/bootstrap-controller.sh

Notes: During installation you might see the installer will try to regenerate the RSA key. Just choose ‘N’.

Is this your Controller host IP, 192.168.1.210 [Y/n]: Y
What is your username [ubuntu] (e.g, ubuntu or root for RHEL): root
Where do you want to have the ClusterControl config files [/root/s9s]:
Where is your ssh key [/root/.ssh/id_rsa]:
Enter a MySQL root password to be set for the MySQL server on the Controller host [password]:
* On debian/ubunu when installing the MySQL server please enter the above root password when prompted
 
What is your DB cluster type [galera] (mysqlcluster|replication|galera|mysql_singl):
Where are your DB hosts [ip1 ip2 ip3 ... ipN]: 192.168.1.201 192.168.1.202 192.168.1.203
Enter the MySQL root password on the agent/DB hosts [password]: MyDBp4ss67
Thank you...
 
Install a MySQL Server and rrdtools? [Y/n]: Y
Install ClusterControl Controller? [Y/n]: Y
Install apache2 and php5 [Y/n]: Y
Install ClusterControl's Web application? [Y/n]: Y

6. Once done, we need to run the bootstrap script for agents. This will remotely install and configure required package in order to control Galera cluster from the ClusterControl server:

$ bin/bootstrap-agents.sh

7. Install the JPgraph. This is required for ClusterControl to view graph correctly:

$ bin/install-jpgraph.sh

8. If you already configured your MySQL Galera cluster configuration under /etc/my.cnf, we need to copy the file into ClusterControl server under directory /root/s9s/mysql/config. As for me, I skip this steps because I have nothing configured inside /etc/my.cnf in cluster nodes.

$ scp root@galera1:/etc/my.cnf /root/s9s/mysql/config

9. Start cmon service, cron and enable cron on startup:

$ service cmon start
$ chkconfig crond on
$ service crond start

10. Installation done. Login into ClusterControl page at http://192.168.0.210/cmon. We need to change the cluster name to Galera cluster name. You can retrieve this using following command inside any Galera nodes:

$ mysql -e 'show variables' | grep wsrep_cluster_name
wsrep_cluster_name      my_wsrep_cluster

So my Galera cluster name is my_wsrep_cluster.

Go to ClusterControl > Galera Cluster ‘default_cluster_1′(1/0) > Administration > Cluster Settings and change the Cluster Name as below:

Save the changes and you are done. Just wait for a while and you will notice that your Galera cluster nodes will be counted as 1/3 at the Dashboard similar as below:

You do not even need to login into your Galera cluster nodes in order to complete this integration process. Believe me, this tool is a must if you have MySQL Galera cluster setup. I will start integrating ClusterControl into all of my Galera cluster set ASAP!

2 thoughts on “CentOS: Integrate ClusterControl into Existing MySQL Galera Cluster

  1. Hi! Do you know if they make any plugins to protect against hackers?
    I’m kinda paranoid about losing everything I’ve worked hard on.
    Any suggestions?

    Reply

    1. I am sorry as I do not know about any “protection against hackers” plugin but you may contact them directly as refer to here.

      Reply

Leave a Reply

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