MySQL ReplicaSet and InnoDB Cluster are both scalable, fault-tolerant, high-availability solutions offered by MySQL. When deciding on which is the best option, it comes down to how the architecture and functionality meet the needs of your organization. This blog explores their advantages and disadvantages.

MySQL ReplicaSet

MySQL ReplicaSet is a feature introduced in MySQL 5.7 to provide asynchronous replication between multiple MySQL instances. It provides fault tolerance and load balancing capabilities where data changes made on the primary server are asynchronously replicated to the secondary servers. However, there can be a slight delay between the primary server and the secondary servers, which can lead to potential data inconsistencies if a failover occurs before all data changes are replicated.

Figure 1 illustrates the architecture of the ReplicaSet, where the source is the read/write instance, and replica is the read-only instance. Changes made on the source are logged in the binlogs. The binlogs dump the data changes into the relay logs. The relay log applies those changes to the replica’s database. This is the simplest example of a ReplicaSet. A ReplicaSet can have multiple replicas and multiple sources.

MySQL ReplicaSet Architecture
Figure1: MySQL ReplicaSet Architecture

A ReplicaSet lacks an integrated management tool and router, which has its disadvantages. Mainly, it requires manual intervention for failover, which can introduce additional downtime and administrative overhead. However, it also allows clients to connect directly to any server in the replica set.

MySQL InnoDB Cluster

InnoDB Cluster is a more advanced high-availability solution introduced in MySQL 8.0. It combines group replication, MySQL Router, and MySQL Shell to provide a fully integrated solution. Group replication is based on synchronous replication, where data changes made on the primary server are synchronously replicated to the secondary servers. It also provides automated failover and automatic node provisioning, meaning that if the primary server fails, one of the secondary servers is automatically elected as the new primary, ensuring continuous service availability. Another notable difference is the ease of deployment and management. InnoDB Cluster provides a unified management interface through MySQL Shell, allowing administrators to easily configure and manage the cluster.

Figure 2 depicts the architecture of the InnoDB Cluster. In this example, the primary node is the only read/write node. It’s worth noting that InnoDB Cluster requires MySQL Router for client connections, which adds an additional component to the architecture. If the MySQL instance fails, a secondary node will automatically be appointed as the new primary node. The MySQL Router will route traffic accordingly without any intervention from a DBA. Three nodes is the minimal requirement for an InnoDB Cluster. A cluster can have more than three nodes as well as more than one read/write node.

MySQL InnoDB Cluster Architecture
Figure 2: MySQL InnoDB Cluster Architecture

The InnoDB Cluster has its advantages. It uses group replication, which ensures that all data changes are propagated to the secondary servers before committing. Moreover, the InnoDB Cluster offers more flexibility in terms of read scaling by allowing you to distribute read traffic across multiple secondary servers. It is important to note the cluster’s high availability is dependent on the network stability.

In conclusion, while both MySQL ReplicaSet and InnoDB Cluster offer high-availability solutions, InnoDB Cluster provides a more advanced and integrated solution with features like synchronous replication, automated failover, and automatic node provisioning. It simplifies deployment and management through MySQL Shell and offers more scalability options. ReplicaSet, on the other hand, is a simpler solution that can be suitable for scenarios where asynchronous replication and manual failover are acceptable and network issues are more frequent. The choice between these solutions depends on your specific requirements and the level of automation and ease of management you desire. Table 1 summarizes the difference in functionality for easy comparison.

If you have any questions about our MySQL Services and Support or would like to learn more, please contact us!

Share This