MySQL Group Replication extends traditional primary-replica replication with a built-in, distributed consensus protocol (Paxos-based) that provides automatic failover, multi-primary writes, and conflict detection. Unlike standard replication where a manual intervention is needed to promote a replica to primary, Group Replication automatically elects a new primary if the current primary fails — making it the foundation of MySQL InnoDB Cluster. Group Replication supports two modes: single-primary mode (one primary accepts writes, others are read-only — recommended for most use cases) and multi-primary mode (all members accept writes with conflict detection). This guide sets up a 3-node MySQL Group Replication cluster in single-primary mode on RHEL 9, which is the minimum viable group size for a majority quorum.

Prerequisites

  • Three RHEL 9 servers with MySQL 8 installed
  • Node 1: 10.0.1.10, Node 2: 10.0.1.11, Node 3: 10.0.1.12
  • All three nodes can reach each other on port 3306 and 33061

Step 1 — Configure All Three Nodes

# Apply on ALL three nodes — change server-id and local_address per node
# /etc/my.cnf.d/group_replication.cnf

[mysqld]
# Unique per node: 1, 2, 3
server-id = 1

# GTID (required)
gtid_mode                    = ON
enforce_gtid_consistency     = ON

# Binary log
log_bin                      = /var/lib/mysql/mysql-bin
binlog_format                = ROW
binlog_row_image             = FULL
log_replica_updates          = ON

# Group Replication settings
plugin_load_add              = group_replication.so
group_replication_group_name = "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"   # Generate with: python3 -c "import uuid; print(uuid.uuid4())"
group_replication_start_on_boot = OFF
group_replication_local_address = "10.0.1.10:33061"    # Change per node
group_replication_group_seeds  = "10.0.1.10:33061,10.0.1.11:33061,10.0.1.12:33061"
group_replication_bootstrap_group = OFF
systemctl restart mysqld  # On all three nodes

Step 2 — Create Replication User on All Nodes

# Run on ALL three nodes
mysql -u root -p <<'SQL'
SET SQL_LOG_BIN=0;
CREATE USER 'repl'@'%' IDENTIFIED WITH caching_sha2_password BY 'ReplPass123!';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
CHANGE REPLICATION SOURCE TO SOURCE_USER='repl', SOURCE_PASSWORD='ReplPass123!' FOR CHANNEL 'group_replication_recovery';
SQL

Step 3 — Bootstrap the First Node

# Run ONLY on Node 1 — bootstrapping starts the group
mysql -u root -p <<'SQL'
SET GLOBAL group_replication_bootstrap_group=ON;
START GROUP_REPLICATION USER='repl', PASSWORD='ReplPass123!';
SET GLOBAL group_replication_bootstrap_group=OFF;
SQL

Step 4 — Join Nodes 2 and 3

# Run on Node 2 and Node 3 (not Node 1)
mysql -u root -p -e "START GROUP_REPLICATION USER='repl', PASSWORD='ReplPass123!';"

Step 5 — Verify the Group

# Check group membership from any node
mysql -u root -p -e "SELECT MEMBER_ID, MEMBER_HOST, MEMBER_STATE, MEMBER_ROLE FROM performance_schema.replication_group_members;"

All three nodes should show MEMBER_STATE=ONLINE. One will be ROLE=PRIMARY.

Step 6 — Enable Auto-Start

# Set start on boot (after the group is verified working)
# On all nodes, edit /etc/my.cnf.d/group_replication.cnf:
group_replication_start_on_boot = ON

Conclusion

MySQL Group Replication on RHEL 9 provides automatic primary election and failover for MySQL databases without external tools. A 3-node single-primary group tolerates the loss of one node while maintaining quorum. For production deployments, MySQL InnoDB Cluster (which wraps Group Replication) adds a MySQL Router for automatic client connection routing to the current primary.

Next steps: How to Configure MySQL Primary-Replica Replication on RHEL 9, How to Back Up MySQL with mysqldump on RHEL 9, and How to Monitor MySQL with Prometheus on RHEL 9.