I just did it, you did it also once and you will do it in the future or if you are on this page because you want to do it right know, its a honor for me to help you with.
Setup a mariadb (galera) cluster is very easily.


First of all, you should install the MariaDB repository. You'll find the right repo for you linux-distro on the webpage of MariaDB. Cause I like to use a rhel-based linux, I'll use a CentOS in this tutorial. So if you use CentOS as well, you can use the following repo-code-snippet.

With "vi /etc/yum.repos.d/mariadb" you'll create a new Repo-Configfile. Here is the MariaDB 10.3 Repository-Config

# MariaDB 10.3 CentOS repository list - created 2019-05-30 18:12 UTC
# http://downloads.mariadb.org/mariadb/repositories/
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64

After that, you can install the packets.

Install pakets

You have to install the following packets:

yum install MariaDB-server galera MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common


To use a cluster, you need at least two nodes, but I think you already installed two Server for this cluster 😉 . Before configuring the two nodes, we stop the daemons with "systemctl stop mariadb". Oh yes, we also can activate the daemon for starting with the OS after rebooting the system 🙂 with "systemctl enable mariadb".

Now we can configure the node with the following snippets in this configfile "/etc/my.cnf.d/server.cnf". You have to set at least the following parameters.

# * Galera-related settings
# Mandatory settings
# Galera Synchronization Configuration
# Galera Node Configuration
# Allow server to accept connections on all interfaces.
# Optional setting

With this configuration the cluster is ready to use. Of course, you have to use this configuration on both nodes.

Initialize the Cluster

First of all, we have to initialize the cluster for the first use. To do that, we have to use mysqld --wsrep-new-cluster or. galera_new_cluster. This will setup the cluster. Please do not use this, to start the cluster or a node.
You can start the second node with systemctl start mariadb.

Restarting the Cluster

If you have to restart a clusternode, it is important to do that separatly. If you don't do that, you can lose some data or risk an inkonsistent db.
If both nodes are "dying" at the same time, you have to start the cluster with galera_recovery. In some cases the restart will fail, then you have to analyze which node is the primary node.
You can determine this with the file grastate.dat in the mysql-dir. The node with the higher seqno in the grastate.dat ist the node you should start first.
If the vale is -1, you have to start both server with wsrep_recover. MariaDB will now recover the seqno and you should be able to determine which server you should start first.