+4 votes
266 views
in Technical issues by (242k points)
reopened
Galera Cluster: overview of a MariaDB cluster

1 Answer

+5 votes
by (1.6m points)
edited
 
Best answer

What is Galera Cluster?
How do Galera MariaDB clusters work?
What is the structure of a Galera Cluster like?
What are the benefits of a MariaDB cluster?
Use cases: what is Galera Cluster used for?
Database applications with high write performance requirements
Clustering for WAN
Disaster Recovery (disaster recovery plan)

image

Galera Cluster: overview of a MariaDB cluster

In modern database management solutions, uninterrupted operation and high availability are as indispensable characteristics as flexibility in expansion options . Only then is it possible to meet the demands of today's systems, where accesses fluctuate strongly and there are unpredictable load peaks. The complexity of this maneuver lies in meeting these requirements with minimal infrastructure costs in the cloud..

Galera Cluster helps you in this difficult task: the solution clustering multimaster for databases is based on synchronous replication high performance for all nodes in a network of databases always have the same data in real time. Available for MariaDB, among others, Galera Cluster minimizes data loss and guarantees the highest reliability. Next, we will tell you how exactly MariaDB clusters based on Galera Cluster work, what are the advantages of this technology and exactly what it is used for.

Index
  1. What is Galera Cluster?
  2. How do Galera MariaDB clusters work?
  3. What is the structure of a Galera Cluster like?
  4. What are the benefits of a MariaDB cluster?
  5. Use cases: what is Galera Cluster used for?
    1. Database applications with high write performance requirements
    2. Clustering for WAN
    3. Disaster Recovery (disaster recovery plan)

What is Galera Cluster?

Galera Cluster is a software package for Linux operating systems that allows the creation and management of MySQL, XtraDB and MariaDB clusters. This cluster application is based on the InnoDB storage engine or its derivative XtraDB. It is experimentally compatible with the MyISAM engine, which for a long time was also used in MySQL and MariaDB as a predecessor to InnoDB. Galera Cluster applies the principle of synchronous replication to the storage of data on the various independent nodes of the cluster. All the processes of copying and modifying the stored data take place simultaneously in all the primary and secondary storage units, so that the data present in all the nodes is always up-to-date and does not differ between them..

The minimal expression of a Galera Cluster consists of three nodes (developers generally recommend using an odd number). If one of the nodes fails during the data transaction, for example due to network or system problems, the other two nodes still form the majority required to complete the transaction successfully.

advice

The database systems that benefit from Galera Cluster are MariaDB and MySQL. Our article MariaDB vs. MySQL contains a detailed comparison between the two data management applications..

How do Galera MariaDB clusters work?

A MariaDB cluster based on Galera Cluster is characterized by the fact that all nodes in the network have the same data at all times. Therefore, in cluster software , the traditional distinction between master (writable servers) and slave (readable only) database servers disappears. Users can write data to any storage node and it will be automatically forwarded to all other participants in the cluster. This property is also called a multimaster .

To guarantee this flexible data exchange, Galera Cluster uses a synchronous replication procedure for administration, based on the exchange of certificates . If the data is replicated, that is, it is written to one of Galera's MariaDB cluster databases, these two principles apply:

  1. Each transaction in the database is assigned a unique sequence number . Before a node in the cluster approves the respective changes to the database, it compares the sequence number with the number of the last committed transaction. In the check, all nodes reach the same conclusion ( Transaction Confirmed or Transaction Declined ). The node that started the transaction transmits the result to the client.
  2. In each transaction, all the replicas of the database are updated . Thus, if a transaction is confirmed after certification, all nodes make corresponding changes to their data record. If the nodes in a Galera Cluster experience a technical problem, they can only be temporarily excluded from synchronous replication.

What is the structure of a Galera Cluster like?

The internal architecture of a Galera Cluster is structured around these four components:

  • Database management system : the DBMS is the central unit of the cluster. The corresponding database server runs on each node. As we already mentioned, Galera Cluster is compatible with MySQL and Percona XtraDB, in addition to MariaDB.
  • Wsrep API : The wsrep API defines and implements the interface and access functions to the database servers involved. Also, wsrep handles data replication. Among other things, the API provides the wsrep hooks (links to the database server for replication) and the dlopen () function , which allows communication with the hooks .
  • Plugin replication Galley or Galera replication plugin : This plugin implements the API wsrep. For this, it provides a layer for the certification process, a layer for replication (including protocol), and the group communication framework.
  • Group communication plugins or Group Communication plug-ins : Galera Cluster provides various extensions for the implementation of group communication systems such as the Spread Toolkit or gcomm. These plugins are based on the group communication framework.
image
Graphic of the internal architecture of a Galera Cluster

What are the benefits of a MariaDB cluster?

We have already mentioned in this article the main advantages of Galera's MariaDB clusters. Switch to this technology cluster offers flexibility in data storage without giving up a maximum of reliability and availability , which is not possible in the usual configurations MariaDB.

Synchronous replication ensures that all involved storage units are up to date at all times. Galera Cluster automatically sends all changes to all drives in the database, completely eliminating the need for manual copies or time-consuming backup processes. The multimaster approach also allows access to all servers of the integrated MariaDB database to write, modify or delete their data. Since nodes can be close to clients, latency can be minimized .

Another advantage of a MariaDB cluster based on a Galera Cluster is the excellent cloud support of this type of architecture. They are particularly well suited to flexible and cloud-based scalability of database resources. Even the distribution of data to different data centers is no longer a problem, as each transaction in Galera Cluster only needs to be sent once to each data center.

Note

IONOS offers tailor-made SQL server hosting. You will be able to choose between different server and hosting solutions for your customized database system with MariaDB, MySQL or MSSQL.

Use cases: what is Galera Cluster used for?

A Galera MariaDB cluster is an excellent solution to manage your own database solution, thanks to the features and benefits we have already mentioned. Specifically, cluster configuration covers, among others, the following use cases:

Database applications with high write performance requirements

By distributing write operations across the group, you can optimize the use of available writing resources. After the initial processing of a customer transaction, the nodes to which the transaction is broadcast only have to record the changes made. Thus, the Galera Cluster replication method generally guarantees a much higher write performance than most database configurations offer, which makes cluster technology very attractive for write intensive applications.

Clustering for WAN

On Internet WANs (Wide Area Networks), Galera Cluster also works without problems. Although there is a small delay (delay in transmission) proportional to the network packet rotation time (RTT), this only affects the process of confirming incoming transactions to the database. The use of MariaDB clusters in the cloud is therefore one of the most interesting examples.

Disaster Recovery (disaster recovery plan)

The principle of Disaster Recovery is as follows: data is stored separately in a separate data center to maintain a complete picture of it, so that it can be retrieved in an emergency. This approach is closely related to the general storage and management of data assets in the cloud. In this case, Galera Cluster transmits the replicated data, but does not make it available to process customer transactions. If a system reset is required, the Disaster Recovery portion of the MariaDB cluster temporarily becomes the primary instance to minimize downtime.

advice

Our article The Importance of a Disaster Recovery Plan contains detailed information on the disaster recovery plan.


...