How to install and configure Galera MySQL cluster on CentOS 7
To install and configure Galera MySQL Cluster on CentOS 7
MariaDB Galera Cluster is a synchronous multi-master cluster for MariaDB. It is available on Linux only, and only supports the XtraDB/InnoDB storage engines. In this tutorial am going install and configure Mariadb cluster 10.0 with 3 nodes on centos 7.
Features
- Synchronous replication
- Active-active multi-master topology
- Read and write to any cluster node
- Automatic membership control, failed nodes drop from the cluster
- Automatic node joining
- True parallel replication, on row level
- Direct client connections, native MariaDB look & feel
Before you begin with the configuration, make sure do the following steps :-
1. Disable the Selinux service.
sestatus
sudo setenforce 0
sestatus
sudo setenforce 0
Open the/etc/selinux/config
file and set theSELINUX
mod todisabled
:/etc/selinux/config# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
- Save the file and reboot your CentOS system with:
sudo shutdown -r now
- Once the system boots up, verify the change with the
sestatus
command:sestatus
The output should look like this:SELinux status: disabled
2. Disable the firewall service.
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl stop firewalld
sudo systemctl disable firewalld
Cluster details
Node1 192.168.7.211
Node2 192.168.7.212
Node3 192.168.7.213
Configuring Galera
Remove defaults MariaDB library files for all the three nodes
Once it is removed, create the MariaDB repository file for all three nodes as follows.
Now, install socat dependency package in all the 3 nodes. Use the following command for the same purpose.
Now is the time to install MariaDB Galera cluster 10.0 and its dependencies packages for all the nodes.
Once it is installed, start the MariaDB services
Execute the following commad to set MariaDB root login credential.
Now you can stop MariaDB service by running the following command. Do the same for all the three nodes.
You can now go on with Galera cluster configuration by adding the cluster address, cluster name, node address, etc. Don' t forget to do the same for the other two nodes as well.
For configuring this cluster configuration on node2 and node3 do not forget to adjust the wsrep_node_address and wsrep_node_name variables. Before doing this steps stop the mysql service on both nodes.
For node2:
For db3
Once all the nodes are configured, you can start first cluster node.
This command should be executed only on node1.
After that, sart MySQL service on both node2 and node3 as well. Run the following command on both the remaining nodes.
Now check the status of configured galera cluster at node1. Repeat this command on node2 and node3 to check
Now, you can check replication process by creating a database from node1.
After that login mysql into node2 and check the replication process there too.
Login mysql into node3 and check the replication process in it as well.
If you want to test more repilcatiom proess create a table and insert the values into that DB.
Node1
Node2
Node3
Tidak ada komentar:
Posting Komentar