In MariaDB Cluster, the Server replicates a transaction at commit time by broadcasting the write set associated with the transaction to every node in the cluster. The client connects directly to the DBMS and experiences behavior that is similar to native MariaDB in most cases. The wsrep API (write set replication API) defines the interface between Galera replication and MariaDB.Galera’s replication is not completely synchronous. It is sometimes called virtually synchronous replication. Galera replication is a highly transparentscalable, and virtually synchronous replication solution for database clustering to achieve high availability and improved performance.

You can check the official site Maria-db Galera site here.

Here;s example how to configure.

  1. Install MariaDB server and Galera replication package on each server:
sudo apt-get update
sudo apt-get install mariadb-server galera-4
  1. Configure MariaDB server for Galera replication:
sudo nano /etc/mysql/conf.d/galera.cnf

Add the following lines to the file:

makefileCopy code[galera]

# Galera Provider Configuration

# Galera Cluster Configuration

# Galera Synchronization Configuration

Note: Replace “ip1,ip2,ip3” with the IP addresses of your Galera cluster nodes.

  1. Start the MariaDB service on the node at ip1
sudo systemctl start mariadb
  1. Secure the MariaDB installation:
sudo mysql_secure_installation
  1. Test the Galera replication by creating a sample database on one node and checking if it is replicated to the other nodes:
mysql -u root -p

On another node, check if the “testdb” database is replicated:

mysql -u root -p -e "SHOW DATABASES;"

You now have MariaDB Galera replication configured and running on your Ubuntu 22.04 server. You can add more nodes to the Galera cluster by repeating steps 1-5 on each node, and updating the “wsrep_cluster_address” parameter in step 2 to include the new nodes.

Previous ArticleNext Article

Leave a Reply

Your email address will not be published. Required fields are marked *