{"id":19042,"date":"2023-09-08T04:23:17","date_gmt":"2023-09-08T04:23:17","guid":{"rendered":"https:\/\/www.insentragroup.com\/us\/insights\/uncategorized\/a-step-by-step-guide-to-mariadb-galera-cluster-installation-and-configuration\/"},"modified":"2024-12-13T02:00:10","modified_gmt":"2024-12-13T02:00:10","slug":"a-step-by-step-guide-to-mariadb-galera-cluster-installation-and-configuration","status":"publish","type":"post","link":"https:\/\/www.insentragroup.com\/us\/insights\/geek-speak\/modern-workplace\/a-step-by-step-guide-to-mariadb-galera-cluster-installation-and-configuration\/","title":{"rendered":"A Step-by-Step Guide to MariaDB Galera Cluster Installation and Configuration"},"content":{"rendered":"\n<p>In today&#8217;s fast-paced digital landscape, database management is a critical aspect of any organization&#8217;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.\u00a0<\/p>\n\n\n\n<p><strong>MariaDB Galera Cluster Features:<\/strong>&nbsp;<\/p>\n\n\n\n<p>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:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Close-Synchronous Replication:<\/strong> Achieve near-synchronous replication, ensuring minimal duplication lag.&nbsp;<\/li>\n\n\n\n<li><strong>Multi-Primary Active-Active Topology:<\/strong> Harness the full potential of your cluster with multiple active nodes, distributing read and write operations across the network.&nbsp;<\/li>\n\n\n\n<li><strong>Read\/Write to Any Cluster Node:<\/strong> Enjoy the flexibility of reading from and writing to any node within the cluster.<\/li>\n\n\n\n<li><strong>Automatic Node Recovery:<\/strong> Failed nodes are automatically removed from the cluster thanks to membership control, ensuring uninterrupted service.&nbsp;<\/li>\n\n\n\n<li><strong>Automatic Cluster Node Join:<\/strong> Easily scale your cluster by adding nodes, a process that&#8217;s handled automatically.&nbsp;<\/li>\n\n\n\n<li><strong>True Row-Level Parallel Replication:<\/strong> Achieve efficient data replication at the row level for optimal performance.&nbsp;<\/li>\n\n\n\n<li><strong>MariaDB Native Look and Feel:<\/strong> Benefit from a familiar environment with direct client connections, making migration and management a breeze.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Benefits of MariaDB Galera Cluster:<\/h3>\n\n\n\n<p>The advantages offered by MariaDB Galera Cluster are numerous and indispensable for a DBMS clustering solution:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>No Duplication Lag (Near Synchronous):<\/strong> Keep your data in sync across nodes with minimal delay, ensuring data integrity.&nbsp;<\/li>\n\n\n\n<li><strong>No Lost Transactions:<\/strong> Eliminate the risk of transaction loss, providing peace of mind for critical operations.&nbsp;<\/li>\n\n\n\n<li><strong>Reduced Latencies:<\/strong> Experience reduced response times and latency, enhancing the user experience and overall system performance.&nbsp;<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installation and Configuration Flow&nbsp;<\/h2>\n\n\n\n<p>&nbsp;To help you get started with MariaDB Galera Cluster on your Red Hat 8 servers, we&#8217;ve outlined the essential steps below:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log into all servers used for the mariadb\/galera cluster&nbsp;<\/li>\n\n\n\n<li>Install mariadb-server-galera package on all servers:&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>dnf install mariadb-server-galera -y <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure that firewalld is running on all the cluster nodes:&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status firewalld \n<br>\nsystemctl enable firewalld --now <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add galera service to firewalld:&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>firewall-cmd --add-service=galera --permanent \n<br>\nfirewall-cmd --add-service=galera \n<br>\nfirewall-cmd --reload \n<br>\nfirewall-cmd --list-all <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>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:&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>vi \/etc\/my.cnf.d\/galera.cnf\u202f \n<br>\n<br> \n<br>\n# Enable wsrep \n<br>\n<br> \n<br>\nwsrep_on=1 \n<br>\n# Full path to wsrep provider library or 'none' \n<br>\nwsrep_provider=\/usr\/lib64\/galera\/libgalera_smm.so \n<br>\n# Provider specific configuration options \n<br>\n#wsrep_provider_options= \n<br>\n# Logical cluster name. Should be the same for all nodes. \n<br>\nwsrep_cluster_name=\"gcomm\" \n<br>\n# Group communication system handle \n<br>\nwsrep_cluster_address=\"gcomm:\/\/ip_address_01,ip_address_02\" <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run the following command on the primary cluster node:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>galera_new_cluster <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>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):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start mariadb <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>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:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql_secure_installation <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Connect to the database on one of the nodes:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create test database:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE DATABASE IF NOT EXISTS test; <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create the table:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>CREATE TABLE test.names (\u202fid INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(255)); <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Insert some values into the table:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>INSERT INTO test.names(name) VALUES (\"Walker Percy\"), (\"Kate Chopin\"), (\"William Faulkner\"), (\"Jane Austen\"); <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>10. Verify if the database returns expected values:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM test.names; <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Connect to another cluster node and connect to the database using&nbsp;&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Verify if there is access to the same data from each cluster node:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>SELECT * FROM test.names; <\/code><\/pre>\n\n\n\n<p>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&#8217;s capabilities in more depth, please don&#8217;t hesitate to <a href=\"https:\/\/www.insentragroup.com\/us\/contact\/\" target=\"_blank\" rel=\"noreferrer noopener\">contact us<\/a>. 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.<\/p>\n\n\n\n<style>\nbody .wp-block-code>code {\n    font-family: Menlo,Consolas,monaco,monospace;\n    color: #000;\n    padding: 30px 40px;\n    border: none;\n    border-radius: 4px;\n    background: #ddd;\n}\n<\/style>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install &#038; configure MariaDB Galera Cluster for high-performance database management on Red Hat 8 servers.<\/p>\n","protected":false},"author":67,"featured_media":19043,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"content-type":"","footnotes":""},"categories":[19],"tags":[],"class_list":["post-19042","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-modern-workplace","entry"],"_links":{"self":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts\/19042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/users\/67"}],"replies":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/comments?post=19042"}],"version-history":[{"count":3,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts\/19042\/revisions"}],"predecessor-version":[{"id":23141,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/posts\/19042\/revisions\/23141"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/media\/19043"}],"wp:attachment":[{"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/media?parent=19042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/categories?post=19042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.insentragroup.com\/us\/wp-json\/wp\/v2\/tags?post=19042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}