How to Install Galera Cluster And Configure on CentOS 7
Galera is the short name of the Galera cluster, which is a multi-master database cluster that provides synchronous replication to MySQL or MariaDB. With Galera in use, the read and write requests can be directed to different nodes based on need; this allows a node to be compromised or lost without experiencing an interruption in normal operation. Galera provides improvements for high levels of availability in MySQL and MariaDB; Galera manages to offer robust data integrity and performance in ways that previous solutions have failed to accomplish.
To get started installing Galera on CentOS 7, you will need to have three nodes that already have Linux CentOS 7 installed, up to date, and running with root access. The nodes you choose can be on a cloud server or a dedicated server, whichever you prefer.
Install Galera on CentOS 7
First, you will need to disable SELinux on each of the three CentOS 7 nodes you have running:
Once the nodes have SELinux disabled, it’s time to create the MariaDB repository to install Galera on each of the three nodes:
Save & Exit
After the repository has been created, it’s time to install Galera and any software requirements on each of the three nodes:
Now you can start MySQL and secure MySQL on each node:
When MySQL is secured, you can add the Galera configuration to each node:
There are changes that need to be made to the second and third node.
The change to node 2:
The change to node 3:
After completing the changes, start the cluster on node 1 only:
When complete, it’s time to log into MySQL on each node to verify the cluster is functioning correctly:
Now you can create a database to test the cluster on node 1:
It’s time to log into node 2 and node 3, checking if the database created in node 1 exists:
Congratulations, you’ve successfully completed the installation of Galera on your nodes running CentOS 7. Now you can move your database cluster into production. If you found this tutorial helpful, please share it with other users setting up Galera on CentOS as well.