InnoDB Cluster
MySQL InnoDB Cluster combines three components into a fully managed HA solution:
- Group Replication — synchronous multi-master replication with automatic failover
- MySQL Shell (
mysqlsh) — orchestrates cluster bootstrapping and management - MySQL Router — transparent connection routing that directs reads/writes to the right node
dbdeployer automates the entire setup. You get a working cluster with a router in one command.
Minimum version: MySQL 8.0+
Requirements
Section titled “Requirements”Before deploying, ensure the following are installed and in your PATH:
mysqlsh(MySQL Shell) — required for cluster bootstrappingmysqlrouter(MySQL Router) — required unless you use--skip-router
which mysqlsh mysqlroutermysqlsh --versionmysqlrouter --versionDeploy an InnoDB Cluster
Section titled “Deploy an InnoDB Cluster”dbdeployer deploy replication 8.4.8 --topology=innodb-clusterThis bootstraps a 3-node Group Replication cluster via MySQL Shell, then starts MySQL Router pointed at it.
~/sandboxes/ic_msb_8_4_8/├── node1/ # GR node (primary)├── node2/ # GR node (secondary)├── node3/ # GR node (secondary)├── router/ # MySQL Router instance│ ├── router_start│ ├── router_stop│ └── router.conf├── check_cluster├── start_all├── stop_all└── use_allMySQL Router Ports
Section titled “MySQL Router Ports”| Port | Purpose |
|---|---|
| 6446 | Read/Write — routes to the current primary |
| 6447 | Read-Only — routes to secondaries (round-robin) |
Connect through the router:
# Writes (goes to primary)mysql -h 127.0.0.1 -P 6446 -u msandbox -pmsandbox
# Reads (goes to a secondary)mysql -h 127.0.0.1 -P 6447 -u msandbox -pmsandboxDeploy Without MySQL Router
Section titled “Deploy Without MySQL Router”If you don’t have MySQL Router installed, or want to manage routing yourself:
dbdeployer deploy replication 8.4.8 --topology=innodb-cluster --skip-routerNo router/ directory is created. Nodes are still bootstrapped as a Group Replication cluster via MySQL Shell.
Deploy with ProxySQL Instead of MySQL Router
Section titled “Deploy with ProxySQL Instead of MySQL Router”ProxySQL can serve as the connection router for InnoDB Cluster:
dbdeployer deploy replication 8.4.8 --topology=innodb-cluster \ --skip-router \ --with-proxysqlProxySQL is deployed alongside the cluster and configured with the cluster nodes as backends.
For a comparison of MySQL Router vs ProxySQL for InnoDB Cluster routing, see Topology reference.
Checking Cluster Status
Section titled “Checking Cluster Status”~/sandboxes/ic_msb_8_4_8/check_cluster# Cluster members:# node1:3310 PRIMARY ONLINE# node2:3320 SECONDARY ONLINE# node3:3330 SECONDARY ONLINEOr query the cluster via MySQL Shell:
~/sandboxes/ic_msb_8_4_8/n1 -e \ "SELECT member_host, member_port, member_role, member_state FROM performance_schema.replication_group_members"Router Management
Section titled “Router Management”# Start router~/sandboxes/ic_msb_8_4_8/router/router_start
# Stop router~/sandboxes/ic_msb_8_4_8/router/router_stopAvailable Scripts
Section titled “Available Scripts”| Script | Purpose |
|---|---|
n1, n2, n3 | Connect to cluster node 1, 2, 3 |
check_cluster | Show cluster member status and roles |
start_all / stop_all | Start or stop all cluster nodes |
use_all | Run a query on every node |
router/router_start | Start the MySQL Router |
router/router_stop | Stop the MySQL Router |