All Products
Search
Document Center

ApsaraDB RDS:Use the MGR mode

Last Updated:Mar 28, 2026

MySQL Group Replication (MGR) is a distributed replication mode built on MySQL's binary logging mechanism and the Paxos protocol. For workloads where data loss or stale reads after failover are unacceptable — such as finance, e-commerce, and core transaction systems — MGR provides stronger consistency guarantees than asynchronous or semi-synchronous replication. This topic explains how to enable MGR on an RDS cluster (an ApsaraDB RDS for MySQL instance running RDS Cluster Edition) and how to switch between replication modes.

Why use MGR

MGR uses the Paxos protocol to keep all nodes in sync, giving your RDS cluster three properties that asynchronous and semi-synchronous replication cannot guarantee:

  • Strong data consistency — if the primary node fails, the cluster automatically removes it and promotes a secondary node. Data on the new primary is consistent with what the failed node had committed.

  • High data reliability — a transaction on the primary is committed only after a majority (more than half) of secondary nodes confirm they have received the data, preventing data loss.

  • Configurable global transaction consistency — the group_replication_consistency parameter lets you tune read and write consistency per session based on your workload's needs.

MGR delivers lower throughput than asynchronous replication and uses more memory than both asynchronous and semi-synchronous modes. Test performance-sensitive or memory-constrained workloads before switching to MGR.

Prerequisites

Before you begin, verify that your RDS cluster meets all the following requirements. View the RDS edition, major engine version, and instance type on the Basic Information page of the cluster in the ApsaraDB RDS console.

RequirementValue
RDS editionRDS Cluster Edition
Major engine versionMySQL 8.0
Minor engine version20221231 or later
Storage engineInnoDB
Memory≥ 8 GB
Number of nodesOdd number, ≥ 3
Node specificationsAll nodes must have identical specifications
Database proxy version (if enabled)Maxscale_MySQL_2.2.12_20230302 or later
Product typeStandard
To upgrade from RDS High-availability Edition to RDS Cluster Edition, see Upgrade the RDS edition from RDS High-availability Edition to RDS Cluster Edition. To update the minor engine version, see Update the minor engine version. To upgrade the database proxy version, see Upgrade the database proxy version. To change instance specifications, see Change instance specifications.

Limitations

MGR cannot be enabled if the cluster contains X-Engine tables or tables without primary keys. Run the following queries to check.

Check for X-Engine tables — a result of 0 means no X-Engine tables exist:

SELECT
  COUNT(1)
FROM
  information_schema.TABLES
WHERE
  ENGINE = 'xengine'
  AND table_schema NOT IN(
    'information_schema', 'performance_schema',
    'mysql', 'test', 'sys', '__recycle_bin__'
  );

Check for tables without primary keys — a result of 0 means all tables have primary keys:

SELECT
  COUNT(1) AS count
FROM
  information_schema.TABLES t1
  LEFT OUTER JOIN information_schema.columns t2 ON t1.table_schema = t2.TABLE_SCHEMA
  AND t1.table_name = t2.TABLE_NAME
  AND t2.COLUMN_KEY = 'PRI'
WHERE
  t2.table_name IS NULL
  AND t1.table_type = 'BASE TABLE'
  AND t1.TABLE_SCHEMA NOT IN(
    'information_schema', 'performance_schema',
    'mysql', 'sys'
  );

For the full list of MySQL Group Replication requirements and limitations, see Requirements and Limitations in the MySQL documentation.

Impacts

Switching from asynchronous or semi-synchronous replication to MGR triggers an instance switchover. Perform the switch during off-peak hours and make sure your application is configured to reconnect automatically. For details on what happens during a switchover, see Impacts of an instance switchover.

Billing

MGR is available at no additional charge.

Enable MGR

Enable MGR on a new RDS cluster

When creating an RDS cluster, set Parameter Template to MySQL_InnoDB_8.0_RDS Cluster Edition_MGR Parameter Template. MGR is active as soon as the cluster is created.

Switch an existing RDS cluster to MGR

  1. Go to the Basic Information page of your RDS cluster.

  2. In the Instance Topology Management section, click Change Data Replication Mode.

  3. In the dialog box, set Data Replication Mode to MGR and click confirm.

To switch back to asynchronous or semi-synchronous replication, repeat the same steps and select the target mode.

Usage notes

Fixed parameter settings

When MGR is enabled, the following parameters are set to specific values to ensure cluster stability.

GTID and binary logging — required by the Paxos consensus engine:

gtid_mode=ON
enforce_gtid_consistency=ON
log_slave_updates=ON
binlog_format=ROW
binlog_transaction_dependency_tracking=WRITESET
transaction_write_set_extraction=XXHASH64
master_info_repository=TABLE
relay_log_info_repository=TABLE

Replication and parallel apply — ensures ordered, parallel replay of transactions:

slave_preserve_commit_order=ON
slave_parallel_type=LOGICAL_CLOCK
rpl_semi_sync_master_enabled=OFF
rpl_semi_sync_slave_enabled=OFF

MGR-specific settings — defines the cluster topology and communication stack:

disabled_storage_engines=MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY,XENGINE
replication_communication_stack=MYSQL
group_replication_single_primary_mode=ON
group_replication_paxos_single_leader=ON
group_replication_consistency=BEFORE_ON_PRIMARY_FAILOVER

Choose a consistency level

The group_replication_consistency parameter controls how strictly the cluster enforces read and write consistency. The default value, BEFORE_ON_PRIMARY_FAILOVER, protects reads during failover. Override this per session as needed.

Use the following scenarios to pick the right level for your workload:

ScenarioRecommended value
Your workload is read-heavy and writes are rare. Stale reads are unacceptable.BEFORE on the secondary session — the secondary waits for pending primary transactions before serving the read.
Your workload has many writes. You want to confirm a write has propagated to all nodes before returning success.AFTER on the primary session — the primary confirms commit only after all nodes apply the transaction.
Most traffic tolerates slight staleness, but specific operations (such as permission changes) require full consistency.Set BEFORE or AFTER for those specific sessions only, leaving other sessions at the default.

For implementation details, see Introduction to the MGR mode.

FAQ

Can I switch back from MGR to asynchronous or semi-synchronous replication?

Yes. On the Basic Information page, click Change Data Replication Mode in the Instance Topology Management section, then select the target mode. Switching is bidirectional among asynchronous, semi-synchronous, and MGR.

Can secondary nodes handle read requests in MGR mode?

Yes. However, if secondary nodes are overloaded, write performance on the primary degrades. Enable the database proxy feature with read/write splitting to distribute reads across secondaries while controlling replication latency and read weights. This prevents secondary nodes from becoming a bottleneck.

Does MGR support multi-primary mode?

No. MGR on ApsaraDB RDS for MySQL supports only single-primary mode. Multi-primary mode introduces instability: a jitter or fault on any node affects the availability of the entire cluster.

Why does MGR require at least 8 GB of memory?

MGR adds three sources of memory overhead beyond what normal replication uses:

  • The XCom communication layer maintains a message cache of approximately 1 GB.

  • The transaction certification module keeps an in-memory certification information array.

  • Additional background threads run for group management tasks.

On instances with less than 8 GB of memory, heavy workloads (such as large parallel query bursts) can exhaust available memory and trigger an out-of-memory (OOM) error.

Should I choose a general-purpose or dedicated instance type for MGR?

  • 8–16 GB memory: Use a general-purpose instance. Shared physical resources give the MGR processes more flexibility to use memory that other tenants are not consuming.

  • 32 GB or more: Use a dedicated instance for stronger resource isolation and more predictable peak performance.

API reference

OperationDescription
CreateDBInstanceCreates an instance. To create an RDS cluster with MGR enabled, set DBParamGroupId to rpg-sys-01040407010400 and configure other parameters as needed.
ModifyDBInstanceHAConfigChanges the data replication mode. To switch to MGR, set SyncMode to Mgr.

Next steps