MySQL Group Replication is a MySQL Server plugin that turns a set of servers into a fault-tolerant replication group, in which every transaction is agreed upon by a majority of members before it commits. In database replication, it sits between classic asynchronous replication and fully synchronous clustering: transactions are globally ordered and certified, but remote members apply them on their own schedule.
The plugin is the foundation of MySQL InnoDB Cluster, where MySQL Shell handles administration and MySQL Router directs client connections. It provides automatic failover, membership management and conflict detection without external tooling.
How MySQL Group Replication commits a transaction
Every write follows the same path. The member that receives the transaction executes it locally up to the commit point, captures the write set, which is a list of hashed primary keys of the changed rows, and broadcasts the transaction together with its write set through the group communication system.
The group communication layer, called XCom, implements a variant of the Paxos consensus protocol. It delivers all messages to all members in the same total order. Each member then runs a deterministic certification step: it compares the write set with those of concurrent transactions already ordered ahead of it. If no conflicting row was changed in the meantime, the transaction is certified and commits; otherwise it is rolled back on the originating member.
The table below lists the stages of this pipeline and their purpose.
| Stage | Where it happens | Purpose |
|---|---|---|
| Local execution | Originating member | Runs statements and builds the write set |
| Atomic broadcast | Group communication layer | Agrees on a single global order by majority |
| Certification | Every member | Detects conflicts with concurrent writes |
| Commit or rollback | Originating member | Returns the result to the client |
| Apply | Remote members | Writes the change to relay log and storage |
Because certification is deterministic, all members reach the same verdict independently without an extra voting round. This design is often described as virtually synchronous replication: agreement is synchronous, while applying the data on remote members is asynchronous.
Single-primary and multi-primary modes
Group Replication runs in one of two topologies. In single-primary mode, the default, one member accepts writes and the others are read-only; when the primary fails, the group elects a new one automatically. In multi-primary mode, every member accepts writes and certification resolves conflicts between them.
| Aspect | Single-primary mode | Multi-primary mode |
|---|---|---|
| Write endpoints | One elected primary | All online members |
| Conflict rollbacks | Practically none | Possible on hot rows |
| Failover | Automatic primary election | No election needed |
| Serializable isolation | Supported | Not supported |
| Typical use | Most production deployments | Write scaling with low contention |
Multi-primary mode does not multiply write capacity, because every member still applies every write. It mainly helps when writes are spread across disjoint rows. For most workloads, single-primary mode is the recommended choice, since it avoids certification aborts and several restrictions on foreign keys and concurrent DDL.
Quorum, membership and fault tolerance
A replication group keeps working only while a majority of members is reachable. This quorum rule prevents split-brain: a minority partition cannot commit writes, so two halves of a broken network never diverge. A group supports up to nine members, and the number of tolerated failures follows directly from the group size.
| Group size | Majority needed | Failures tolerated |
|---|---|---|
| 3 members | 2 | 1 |
| 5 members | 3 | 2 |
| 7 members | 4 | 3 |
| 9 members | 5 | 4 |
An even number of members adds cost without adding tolerance, so odd group sizes are the norm. Suspected members are expelled after a configurable timeout, and a server that joins or rejoins catches up through distributed recovery, which copies data from a donor using either binary log transfer or the clone plugin for large gaps.
How it compares with other replication approaches
Group Replication is best understood against its neighbors. It offers stronger guarantees than asynchronous or semi-synchronous replication, because a commit requires majority agreement and failover is built in, yet it does not wait for every replica to apply data before acknowledging a commit.
| Technology | Commit agreement | Failover | Conflict handling |
|---|---|---|---|
| Asynchronous replication | None | External tooling | Not applicable |
| Semi-synchronous replication | At least one replica receives | External tooling | Not applicable |
| MySQL Group Replication | Majority via Paxos | Built in | Write-set certification |
| Galera Cluster | All nodes via group communication | Built in | Write-set certification |
Galera Cluster uses a similar certification-based design but comes from a different code base and is used mainly with MariaDB and Percona XtraDB Cluster. The two are not interchangeable, and their configuration, recovery procedures and monitoring differ.
Requirements, consistency levels and practical limits
Group Replication imposes strict schema and configuration requirements. Tables must use InnoDB and must have a primary key or an equivalent non-null unique key, because certification depends on row identity. Global transaction identifiers (GTIDs) and row-based binary logging must be enabled.
Since MySQL 8.0.14, the group_replication_consistency variable controls read consistency per session or globally. The default EVENTUAL allows a read on a secondary to return slightly stale data, while BEFORE, AFTER and BEFORE_AND_AFTER make reads or writes wait for the group, trading latency for read-your-writes guarantees across members.
- Network latency drives commit latency, because each commit needs a majority round trip; members spread across distant regions slow every write.
- Flow control throttles writers when a slow member falls behind, so one weak server can reduce group throughput.
- Large transactions can exceed message size limits or stall the group, so batch big changes.
- Hot rows in multi-primary mode cause frequent certification failures that applications must retry.
The idea in brief
Imagine a committee of three to nine clerks who each keep an identical copy of the same ledger. Before any entry is written, the clerks agree on which entry comes next, and an entry counts only if most of them have heard about it.
If one clerk falls ill, the others keep working and pick a new leader when needed. If two clerks try to change the same line at once, only one change survives. The key point is that the group decides together, so the copies stay in step and the ledger survives the loss of individual clerks.
A practical scenario
A regional logistics company runs its order management database on three MySQL servers in single-primary mode, placed in three availability zones of one cloud region. MySQL Router on each application host sends writes to the primary and spreads reporting queries across the two secondaries. Network round trips between zones stay around one to two milliseconds, so commit latency rises only slightly compared with a standalone server.
During a hardware failure, the primary disappears at the peak of the afternoon shift. Within roughly ten seconds, the remaining two members confirm the loss, elect a new primary and Router redirects connections. Order entry pauses briefly but no committed order is lost, because every acknowledged commit had already been agreed by a majority. The failed server later rejoins through distributed recovery, restoring full one-failure tolerance without manual data copying.