In today’s fast-paced digital landscape, database management is a critical aspect of any organization’s IT infrastructure. Efficiently harnessing the power of your databases can mean the difference between smooth operations and costly downtime. One solution that has been gaining traction in recent times is MariaDB Galera Cluster.
MariaDB Galera Cluster Features:
MariaDB Galera Cluster is a high-performance, virtually synchronous multi-primary cluster designed exclusively for Linux environments, with support for the InnoDB storage engine. Its impressive array of features includes:
- Close-Synchronous Replication: Achieve near-synchronous replication, ensuring minimal duplication lag.
- Multi-Primary Active-Active Topology: Harness the full potential of your cluster with multiple active nodes, distributing read and write operations across the network.
- Read/Write to Any Cluster Node: Enjoy the flexibility of reading from and writing to any node within the cluster.
- Automatic Node Recovery: Failed nodes are automatically removed from the cluster thanks to membership control, ensuring uninterrupted service.
- Automatic Cluster Node Join: Easily scale your cluster by adding nodes, a process that’s handled automatically.
- True Row-Level Parallel Replication: Achieve efficient data replication at the row level for optimal performance.
- MariaDB Native Look and Feel: Benefit from a familiar environment with direct client connections, making migration and management a breeze.
Benefits of MariaDB Galera Cluster:
The advantages offered by MariaDB Galera Cluster are numerous and indispensable for a DBMS clustering solution:
- No Duplication Lag (Near Synchronous): Keep your data in sync across nodes with minimal delay, ensuring data integrity.
- No Lost Transactions: Eliminate the risk of transaction loss, providing peace of mind for critical operations.
- Reduced Latencies: Experience reduced response times and latency, enhancing the user experience and overall system performance.
Installation and Configuration Flow
To help you get started with MariaDB Galera Cluster on your Red Hat 8 servers, we’ve outlined the essential steps below:
- Log into all servers used for the mariadb/galera cluster
- Install mariadb-server-galera package on all servers:
dnf install mariadb-server-galera -y
- Ensure that firewalld is running on all the cluster nodes:
systemctl status firewalld
systemctl enable firewalld --now
- Add galera service to firewalld:
firewall-cmd --add-service=galera --permanent
firewall-cmd --add-service=galera
firewall-cmd --reload
firewall-cmd --list-all
- Open the configuration file on each server and ensure that the wsrep_on=1, assign the cluster name (wsrep_cluster_name) and specify the cluster_address:
vi /etc/my.cnf.d/galera.cnf
# Enable wsrep
wsrep_on=1
# Full path to wsrep provider library or 'none'
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
# Provider specific configuration options
#wsrep_provider_options=
# Logical cluster name. Should be the same for all nodes.
wsrep_cluster_name="gcomm"
# Group communication system handle
wsrep_cluster_address="gcomm://ip_address_01,ip_address_02"
- Run the following command on the primary cluster node:
galera_new_cluster
- Start the mariadb on all other cluster nodes using the following command (ensure the galera cluster config has been updated on all nodes prior to starting the service):
systemctl start mariadb
- Remove test databases and set root password from the database (Note: given all the nodes are participating in the cluster, you need to do this step on one node only:
mysql_secure_installation
- Connect to the database on one of the nodes:
mysql -u root -p
- Create test database:
CREATE DATABASE IF NOT EXISTS test;
- Create the table:
CREATE TABLE test.names ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255));
- Insert some values into the table:
INSERT INTO test.names(name) VALUES ("Walker Percy"), ("Kate Chopin"), ("William Faulkner"), ("Jane Austen");
- 10. Verify if the database returns expected values:
SELECT * FROM test.names;
- Connect to another cluster node and connect to the database using
mysql -u root -p
- Verify if there is access to the same data from each cluster node:
SELECT * FROM test.names;
By following these steps, you can harness the power of MariaDB Galera Cluster to achieve high availability, performance, and data integrity in your Linux-based database environment. If you have any questions, need further assistance, or would like to explore MariaDB Galera Cluster’s capabilities in more depth, please don’t hesitate to contact us. Our team of experts is here to help you make the most of this impressive technology and ensure it seamlessly integrates into your IT infrastructure.