MySQL Group Replication extends traditional replication with built-in automatic failover and a distributed consensus protocol, making it suitable for high-availability deployments without requiring additional orchestration tools. In single-primary mode, one node accepts writes at a time while all nodes serve reads, and the group automatically elects a new primary if the current one fails. This tutorial configures a three-node Group Replication cluster in single-primary mode on RHEL 8 running MySQL 8.0, walking through the configuration file changes, plugin installation, bootstrapping, and adding replicas.

Prerequisites

  • Three RHEL 8 servers: node1 (192.168.1.10), node2 (192.168.1.11), node3 (192.168.1.12)
  • MySQL 8.0 installed and running on all three nodes
  • Hostnames resolvable between nodes (via /etc/hosts or DNS)
  • Port 3306 (MySQL) and port 33061 (Group Replication communication) open between all nodes
  • A unique UUID generated for the group (use uuidgen on any node)

Step 1 — Open Required Ports on All Nodes

Group Replication uses port 33061 for intra-group communication in addition to the standard MySQL port. Run the following on each of the three nodes, adjusting the source addresses to include the IPs of the other two nodes.

sudo firewall-cmd --permanent --add-port=3306/tcp
sudo firewall-cmd --permanent --add-port=33061/tcp
sudo firewall-cmd --reload

Step 2 — Configure my.cnf on All Three Nodes

Each node needs a shared group UUID, a unique server-id, and a node-specific group_replication_local_address. Generate a UUID once and use the same value on all nodes.

uuidgen
# example output: 6f6a9db7-2a13-11ef-8c1a-0800274b3c6e

On node1, add the following to /etc/my.cnf under [mysqld]:

[mysqld]
server-id                            = 1
log_bin                              = binlog
binlog_format                        = ROW
log_slave_updates                    = ON
binlog_checksum                      = NONE
gtid_mode                            = ON
enforce_gtid_consistency             = ON

plugin_load_add                      = group_replication.so
transaction_write_set_extraction     = XXHASH64

group_replication_group_name         = "6f6a9db7-2a13-11ef-8c1a-0800274b3c6e"
group_replication_start_on_boot      = OFF
group_replication_local_address      = "192.168.1.10:33061"
group_replication_group_seeds        = "192.168.1.10:33061,192.168.1.11:33061,192.168.1.12:33061"
group_replication_bootstrap_group    = OFF
group_replication_single_primary_mode = ON

On node2, use server-id=2 and group_replication_local_address="192.168.1.11:33061". On node3, use server-id=3 and group_replication_local_address="192.168.1.12:33061". The group_replication_group_seeds list and UUID are identical on all nodes.

Restart MySQL on all three nodes after saving the files:

sudo systemctl restart mysqld

Step 3 — Create the Replication User on All Nodes

Each node needs a local replication account that the group uses for distributed recovery. Run these statements on each node individually, logging in as root.

mysql -u root -p
SET SQL_LOG_BIN=0;
CREATE USER 'repl'@'%' IDENTIFIED WITH mysql_native_password BY 'StrongGR@Pass1';
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%';
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;

CHANGE MASTER TO MASTER_USER='repl', MASTER_PASSWORD='StrongGR@Pass1'
    FOR CHANNEL 'group_replication_recovery';

Step 4 — Bootstrap the Primary Node

Bootstrapping creates the group and elects node1 as the initial primary. This must be done only once and only on node1. After the group is running, turn bootstrapping off immediately.

-- On node1 only:
SET GLOBAL group_replication_bootstrap_group = ON;
START GROUP_REPLICATION;
SET GLOBAL group_replication_bootstrap_group = OFF;

Confirm node1 is the primary and the group is online:

SELECT * FROM performance_schema.replication_group_members;

You should see one row with MEMBER_STATE = ONLINE and MEMBER_ROLE = PRIMARY.

Step 5 — Add node2 and node3 to the Group

On each of the remaining nodes, simply start Group Replication. They will contact the seed list, perform distributed recovery, and join the group automatically.

-- Run on node2, then repeat on node3:
START GROUP_REPLICATION;

After both nodes join, verify all three members show MEMBER_STATE = ONLINE:

SELECT MEMBER_HOST, MEMBER_STATE, MEMBER_ROLE
FROM performance_schema.replication_group_members;

Step 6 — Test Automatic Failover

To verify automatic failover, stop MySQL on node1 and confirm that one of the replicas is promoted to primary.

-- On node1:
sudo systemctl stop mysqld
-- On node2 or node3:
SELECT MEMBER_HOST, MEMBER_ROLE
FROM performance_schema.replication_group_members;

One of the remaining nodes should now show MEMBER_ROLE = PRIMARY. Write traffic can be directed to it immediately.

Conclusion

You have deployed a three-node MySQL Group Replication cluster in single-primary mode on RHEL 8. The cluster provides automatic primary election on failure, distributed consensus for every committed transaction, and conflict detection for split-brain prevention. For production use, pair Group Replication with MySQL Router to automatically route application connections to the current primary without application-side changes.

Next steps: How to Configure MySQL Primary-Replica Replication on RHEL 8, How to Back Up and Restore MySQL Databases on RHEL 8, and How to Install MySQL Router for High Availability on RHEL 8.