Introduction to Galera Cluster on MariaDB

Published: 25 August 2024
on channel: Database Dive
322
5

This MariaDB tutorial will tell you that Galera Cluster is a product belonging to a company called Codership focusing in research & development and operating since 2007.
Codership does business through support and consulting and is a partner of MariaDB.
Codership is led by Seppo Jaakola from Helsinki, Finland.

This MariaDB tutorial for beginners will further tell you that Galera is a replication plugin that needs to be loaded into MariaDB Server.
Once the plugin is loaded into MariaDB Server by giving the address to it and the server is started, we'll have a single-node MariaDB cluster.

To add more nodes to the cluster, you start another MariaDB server with Galera Cluster configured and keep the configuration file informed on the address of your cluster as well (that's the variable wsrep_cluster_address.)
All configured database nodes should be specified in this variable.

This MariaDB tutorial will also tell you that there's an SST (State Snapshot Transfer) method that needs to be specified. The method is specified in the wsrep_sst_method variable and it tells your database how to replicate. Most likely this method is going to be set to rsync so that the node could get an rsynced copy of the data directory.

In other words, the files present in the first node will be copied towards the second node.
To add even more nodes, install MariaDB Server, configure the plugin, add the cluster address, and setup the node as you did previously.

The minimum recommended size of the database cluster is 3 because if there are communication problems between the database nodes and two database nodes can successfully communicate with each other, the third node would be automatically kicked out for a while.
The more nodes in your database cluster, the more copies of your data you have available.

Writes (INSERT SQL queries) will be replicated to all database nodes, and all database nodes can be used for reading too.

So, Galera replication is a generic plugin that uses a replication API to interact with your SQL database.
All MariaDB Servers that have Galera replication set up can be joined together and form a MariaDB Galera Cluster.
Galera Cluster necessitates configuration using the wsrep_% variables.

Want to learn more about MariaDB, Galera Cluster, and other sql interview questions and answers?
Subscribe to this database tutorial channel, and until next time.

Music:
Cruising by KV:    / kvmusicprod  
Creative Commons — Attribution 3.0 Unported — CC BY 3.0
Free Download / Stream: https://bit.ly/4dUN73R
Music promoted by Audio Library https://bit.ly/46H4h2n

#sql #mysql #mariadb #galera #database #software