google-templatesmariadb

Understand the default MariaDB cluster configuration

The Bitnami Multi-Tier Solution for MariaDB uses multiple VMs, consisting of 1 primary node and 1 or more replicas, to provide a horizontally scalable and fault-tolerant deployment. Data automatically replicates from the primary node to all replicas. Binary logging is enabled and the MariaDB server is configured to listen for connections from any IP address (0.0.0.0).

To understand how it works, consider the example below of a two-node cluster (one primary and one replica):

  • On the primary node, create a new table and populate it with some data:

      MariaDB [(none)]> USE bitnami;
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A
      Database changed
    
      MariaDB [bitnami]> CREATE TABLE test (id INT NOT NULL, value VARCHAR(255) NOT NULL);
      Query OK, 0 rows affected (0.37 sec)
    
      MariaDB [bitnami]> INSERT INTO test VALUES (1, 'foo'), (2, 'bar');
      Query OK, 2 rows affected (0.07 sec)
      Records: 2  Duplicates: 0  Warnings: 0
    
  • On any of the replicas, check if the table exists and list its contents. It should display the same data originally entered on the primary node:

      MariaDB [(none)]> USE bitnami;
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A
      Database changed
    
      MariaDB [bitnami]> SELECT * FROM test;
      +----+-------+
      | id | value |
      +----+-------+
      |  1 | foo   |
      |  2 | bar   |
      +----+-------+
      2 rows in set (0.00 sec)
    

This shows that records added on the primary node are automatically replicated to the replica(s). For more information, refer to the MariaDB documentation on replication.

Last modification February 3, 2022