MySQL InnoDB Cluster Deployment Guide
This article explains how to use innodb_cluster.yml to deploy a MySQL InnoDB Cluster.
1. Scope of application
- Target architecture: three-node InnoDB Cluster
- Database type:
db_type: mysql - MySQL version:
8.4.xor9.7.x - Management tool: MySQL Shell
Use a fresh environment whenever possible.
innodb_cluster.ymlruns Linux initialization and software preparation before cluster creation, including dependency installation, SELinux changes, stoppingfirewalld, managedsysctlupdates, and package preparation for MySQL and mysqlshell.MySQL
9.7.xusesglibc2.28packages and is not supported on the CentOS/RHEL 7 family; use MySQL8.4.xon those systems.
1.1 Dependency chain
| Item | Details |
|---|---|
| Prerequisites | dbbotctl env setup is complete, the [dbbot_innodb_cluster] inventory is reachable, and the mysqlshell package is either available offline or allowed to auto-download |
| Required variables | db_type: mysql, mysql_version: 8.4.x or 9.7.x, innodb_cluster_primary, innodb_cluster_members, and mysql_cluster_admin_user / mysql_cluster_admin_password |
| Next step | If applications need a stable access layer, continue with innodb_cluster_router.yml; if Router metrics are also required, continue with router_exporter_install.yml and register the targets in Prometheus |
2. inventory
innodb_cluster.yml uses independent host groups:
[dbbot_innodb_cluster]
192.0.2.131 ansible_user=root ansible_ssh_pass="'<your_password>'"
192.0.2.132 ansible_user=root ansible_ssh_pass="'<your_password>'"
192.0.2.133 ansible_user=root ansible_ssh_pass="'<your_password>'"
The IPs above use RFC 5737 documentation ranges and are examples only. Replace them with your actual host addresses.
3. Key variables
Edit mysql_ansible/playbooks/common_config.yml:
db_type: mysql
mysql_version: "8.4.9"
mysql_port: 3307
fcs_allow_dbbot_default_passwd: true
If you temporarily use dbbot’s public default password for experiments, keep fcs_allow_dbbot_default_passwd: true in the snippet above. The default value is false, so deployment will be blocked before execution otherwise.
Edit mysql_ansible/playbooks/vars/var_innodb_cluster.yml:
innodb_cluster_name: "myCluster3307"
innodb_cluster_primary: 192.0.2.131
innodb_cluster_members:
- 192.0.2.131
- 192.0.2.132
- 192.0.2.133
Description:
innodb_cluster_primarymust be included ininnodb_cluster_members.innodb_cluster_membersat least 3 nodes.mysql_mgr_portis automatically calculated asmysql_port * 10 + 1by default.
4. Installation package preparation
Prepare at least:
- MySQL
8.4.xor9.7.xbinary package - A MySQL Shell package that matches
mysql_version, or allow the control node to download it automatically
If you use the offline package, please put it in mysql_ansible/downloads/.
If you store the offline package in a custom directory, also update mysql_ansible/playbooks/common_config.yml and set mysql_packages_dir to that directory.
5. Execute deployment
cd /usr/local/dbbot/mysql_ansible/playbooks
ansible-playbook innodb_cluster.yml
During execution, enter confirm as prompted.
6. Post-deployment validation
Execute on the master node or any node where mysqlshell is installed:
mysqlsh clusteradmin@192.0.2.131:3307
After logging in, execute:
var cluster = dba.getCluster()
cluster.status()
Validation points:
statusreturnsOK/ONLINE- All three members are online
primarynode is consistent with configuration
7. Common precautions
innodb_cluster.ymlcurrently supports MySQL8.4.xand9.7.x.db_typecan only bemysql, notperconaorgreatsql.- It is recommended to complete the basic connectivity check first:
ansible dbbot_innodb_cluster -m ping - If application access is required later, continue to deploy MySQL Router. See: MySQL Router Deployment Guide.