MySQL InnoDB Cluster Deployment Guide
This article explains how to use innodb_cluster.yml to deploy a MySQL 8.4 InnoDB Cluster.
1. Scope of application
- Target architecture: three-node InnoDB Cluster
- Database type:
db_type: mysql - MySQL version:
8.4.x - Management tool: MySQL Shell
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>'"
3. Key variables
Edit mysql_ansible/playbooks/common_config.yml:
db_type: mysql
mysql_version: "8.4.7"
mysql_port: 3307
If you temporarily use dbbot’s public default password for experiments, please explicitly set fcs_allow_dbbot_default_passwd: true. The default value is false, which will intercept the exposure of the default password before deployment.
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.xbinary package - MySQL Shell installation package, or allow the control node to download it automatically
If you use the offline package, please put it in mysql_ansible/downloads/.
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.ymlonly supports MySQL8.4.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.