Introduction
MySQL InnoDB Cluster provides native, highly available, and fault-tolerant database services. It packages three components—MySQL Shell (for configuration), MySQL Router (for connection handling), and the Group Replication plugin—into one cohesive solution. This guide outlines the setup on four Linux nodes.
Prerequisites
Before starting, ensure all four Linux nodes (node1 through node4) meet these requirements:
- MySQL Server: MySQL 8.4 installed on the first three nodes (Refer to my blog on how to install MySQL 8.4.0 https://edson-help.blogspot.com/2025/08/step-by-step-guide-to-setup-mysql-84-on.html)
- Network: All nodes can communicate with each other on the necessary ports (3306, 33060, and Group Replication ports 33061-33062).
- Enable ports 6446 and 6447 on the database nodes for read/write and read-only connections.
- Initial Setup: Each MySQL instance must be initialized, running, and accessible via the MySQL Shell.
- Download the required binaries for MySQL Shell & MySQL Router
Steps for Installing MySQL Shell & InnoDB Cluster Setup
- Install MySQL Shell on all VMs (Repeat for all four nodes)
unzip MySQLShell.zip
yum install mysql-shell-commercial-8.4.7-1.1.el8.x86_64.rpm
2. Add the hostname of each VM on each server for internal DNS resolution.
- 3. Test connection to the MySQL Databases using mysql shell (mysqlsh)
mysqlsh root@mysql-db-02:3307
mysqlsh root@mysql-db-02:3307
mysqlsh root@mysql-db-03:3307
- Check the instance configuration
dba.checkInstanceConfiguration('admin@mysql-db-01:3307')
- Use MySQL Shell to fix issues (confirm required changes)
The MySQL instance will restart during this process.
dba.configureInstance('admin@mysql2:3307')
- Execute the check on the instance configuration again after fixing the issues. Repeat for all three database nodes.
- Create the InnoDB Cluster from the primary node
\connect admin@mysql-db-01:3307
var cluster = dba.createCluster('cdlcluster')
Add the remaining two nodes to the newly created cluster.
cluster.addInstance('admin@mysql-db-02:3307')
cluster.addInstance('admin@mysql-db-03:3307')
- Check the status of the InnoDB Cluster
MySQL Router Deployment
- Enable ports 6446 and 6447 for connections from the router to the InnoDB cluster.
Execute the commands for all three database nodes.
- Unzip the MySQLRouter binary file
- Install MySQL Router via rpm package
- Grant access to the databases to allow connections from the Router.
Repeat these commands on all three database nodes.
- Configure the MySQL Router
sudo mysqlrouter --bootstrap admin@mysql-db-01:3307 --user=mysqlrouter
- Start the MySQL Router sudo systemctl start mysqlrouter
Test the connection with a mysql client connect to 6446 port (read/write). The connection takes you to the primary node mysql-db-01
mysqlsh admin@127.0.0.1:6446
- Test the connection with a client connecting to the 6447 port (read-only mode). The connection takes you to one of the secondary node mysql-db-02/03
mysqlsh admin@127.0.0.1:6447