MariaDB comes with a very interesting way to build clusters: semi-synchronous. SS clusters are exactly in the middle of the well-known architecture; while Galera Cluster is a synchronous multi-master cluster for MariaDB (meaning that the cluster is on hold until all the nodes report back the sync) and asynchronous (the cluster waits for no slaves); SS clusters only wait or one node to report back while the others will catch on later.
Also, you can have a master-master SS cluster.
I will talk in this article about how I did this configuration using MariaDB 10.1.x. Remember you can install MariaDB under Centos 6, 7 and 8 (Rocky as well) by using OKay's repository.
The first thing is to make the host to find each other using hostnames. The easiest way to do it is by adding entries in your /etc/hosts files. You can use DNS as well, it is up to you.
Add/edit the following lines in your my.cnf file or any inside the my.cnf.d directory.
plugin_load_add = semisync_master
Important things here:
Edit the same file as the master, but put the following.
plugin_load_add = semisync_slave
Please note the plugin you are adding is the slave. The same observations happen to the slave nodes.
Just type systemctl start mariadb
CREATE USER 'replication'@'%' IDENTIFIED BY 'your-password';
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%';
I have found notes that they suggest doing it only on the master. However, it is up to you if this may be done in all nodes.
Type these commands in the slave nodes. Make sure the host and username match with the user you created before.
CHANGE MASTER 'label' TO MASTER_HOST='host-1', MASTER_USER='replication', MASTER_PASSWORD='your-password', MASTER_PORT=3306, MASTER_CONNECT_RETRY=10, MASTER_USE_GTID = slave_pos;
START SLAVE 'label';
If for a reason you did something wrong, the RESET SLAVE 'label' or RESET SLAVE ALL commands will help you to delete them.
Good luck!blog comments powered by Disqus