Setting up Galera Cluster with the MariaDB 10.1 Software Collection (RHEL6 and RHEL7)
MariaDB 10.1 has been available for RHEL6 and RHEL7 as a Software Collection since Red Hat Software Collections (RHSCL) 2.2. This article describes how to set up MariaDB Galera Cluster using the rh-mariadb101 Software Collection.
See also Content from mariadb.com is not included.upstream documentation about Galera Cluster and Getting Access to Red Hat Software Collections.
Step 1: Installation
Install the rh-mariadb101-mariadb-server-galera package, which provides all tools and configuration files you need for setting up MariaDB Galera Cluster:
yum install rh-mariadb101-mariadb-server-galera
Step 2: Configuration
Configuration related to Galera Cluster is stored in the /etc/opt/rh/rh-mariadb101/my.cnf.d/galera.cnf file. The only required option for basic replication is wsrep_cluster_address. It should contain the addresses of cluster nodes to connect to upon startup, for example:
wsrep_cluster_address="gcomm://192.168.0.1,192.168.0.2,192.168.0.3"
This example assumes the option above will be set on all three nodes.
For information on other configuration options, see Content from mariadb.com is not included.Galera Cluster System Variables in the upstream documentation.
Step 3: Bootstrapping a new cluster
To bootstrap a new cluster (instead of connecting to an existing one), start the first node using the galera_new_cluster command:
scl enable rh-mariadb101 galera_new_cluster
Note: This command starts the rh-mariadb101-mariadb service with an additional command-line option --wsrep-new-cluster.
Step 4: Adding other nodes to a cluster
Once at least one of the cluster nodes is running, start the rh-mariadb101-mariadb service on the remaining nodes:
RHEL 7+
systemctl start rh-mariadb101-mariadb
RHEL 6
service rh-mariadb101-mariadb start
On startup, the rh-mariadb101-mariadb service connects to the existing cluster according to the wsrep_cluster_address configuration option (see above).
For more information, see Content from mariadb.com is not included.MariaDB Galera Cluster in the upstream documentation.
NOTE:- Galera Cluster requires a number of ports in order to maintain network connectivity between the nodes. Depending on deployment, one may require all or some of these ports on each node in the cluster
- Port 3306 For MySQL client connections and State Snapshot Transfer that use the mysqldump method.
- Port 4567 For Galera Cluster replication traffic, multicast replication uses both UDP transport and TCP on this port.
- Port 4568 For Incremental State Transfer.
- Port 4444 For all other State Snapshot Transfer.