Video: Installing Galera Cluster with MySQL

Codership is pleased to announce the launch of our training video library. The aims are quite clear as we want you to be helped in learning, installing, configuring and running Galera Cluster and related software in a successful fashion. Naturally, this also serves as a good teaser for our training courses which we are going to deliver online. This is part of an upcoming series of blogs covering the video contents, and why you might want to watch them.

Today we are focusing on Installing Galera Cluster with MySQL. Naturally it is worth clicking that link because you will see how well organised it is, including the fact that there are training exercises, slides in case you choose to take this offline, example configuration, as well as a sample company database (note that it is about 64MB in size).

It starts with an introduction of Codership. There is an introduction to Galera Cluster, focusing on nodes, databases, replication, load balancing and High Availability, around the master-slave (primary-secondary, leader-follower) model. It then covers important concepts and wins around Galera Cluster: virtually synchronous replication, multi-master, conflict detection & resolution on commit (when there are conflicting transactions), easy maintenance (automatic node provisioning, node isolation, rolling upgrades).

The basics that you need to be on Linux (CentOS 7 in this video) or FreeBSD, the fact that you want to have odd-numbers of nodes (this training course focuses on 3 nodes), and to ensure that all nodes have equal hardware configuration. The rsync software as well as the firewall software (firewalld) is also something you need. We talk about the Primary Component, and how you may get an Incremental State Transfer (IST) or a State Snapshot Transfer (SST) (it also is a good idea to read: node provisioning). We  then move on to show you the terminal so you can follow along, and how to get the repository URLs for a Galera Cluster repository.

This is based on MySQL 5.7 + Galera 3 which you get from the Codership repositories, so remember that when you execute system start mysqld you will need to grep 'temporary password' /var/log/mysqld.log to get the initial password. Good practice of running mysql_secure_installation is also something Russell covers; and the fact that you need to do this on each of the three nodes.

Configuring Galera Cluster is not just now in your /etc/my.cnf but /etc/my.cnf.d/server.cnf. I can highly recommend you follow the configuration, including turning on the error log. It is worth spending time learning how to configure Galera Cluster, including understanding the basic wsrep_provider_options, the wsrep_slave_threads, and what the wsrep_sst_method should be (it does not go in deep, here you use rsync).

We mention about the ports that you need to open up as well, and to ensure that SELinux understands this. The ports in question are: 3306, 4567 (TCP and UDP), 4444, 4568 (when not specified, just TCP is required). You will also need to set these inbound rules on AWS — this is not pictured in the video, so remember to turn this on in the AWS firewall. Then configuring SELinux (it is good, do not disable it) and the firewall via firewall-cmd is shown.

The video goes on to talk about bootstrapping the cluster, e.g. via mysqld_bootstrap. Within the terminal, and also shows you what it is like in /var/lib/mysql/grastate.dat and the important option of safe_to_bootstrap.

Overall, once you are done with the video, you will be able to have Galera Cluster running. Next up, how to do this with MariaDB Server.