Azure迁移红帽云后,如何将公网IP节点加入MySQL8.0.31 InnoDB集群?
解决InnoDB集群添加公网IP节点报错问题
报错原因
InnoDB集群会校验本地节点的IP配置一致性,现有集群节点使用私有IP通信,当尝试加入公网IP节点时,集群检测到本地节点绑定的IP与加入操作中指定的IP不匹配,触发报错:There is no local IP address matching the one configured for the local node (x.x.x.x:3306)
解决步骤
调整MySQL绑定地址
修改/etc/my.cnf(或对应配置文件)中的bind-address参数为0.0.0.0,允许MySQL监听所有可用IP:bind-address = 0.0.0.0重启MySQL服务生效:
systemctl restart mysqld重新配置本地节点的集群标识
登录现有集群主节点的MySQL Shell,执行以下命令将本地节点的标识更新为公网IP(替换x.x.x.x为节点公网IP,cluster_admin_user为集群管理员账号):dba.configureLocalInstance('x.x.x.x:3306', {clusterAdmin: 'cluster_admin_user', clusterAdminPassword: 'your_password'})添加新节点时指定公网通信参数
在主节点的MySQL Shell中,加入新节点时通过localAddress指定新节点的公网IP:cluster.addInstance('new_node_public_ip:3306', {localAddress: 'new_node_public_ip:3306', clusterAdminPassword: 'your_password'})若需要将原有私有IP节点切换为公网通信,执行:
cluster.rejoinInstance('existing_node_public_ip:3306', {localAddress: 'existing_node_public_ip:3306'})开放必要端口
确保所有节点的防火墙和云安全组开放3306(MySQL服务)和33061(组复制通信)端口:firewall-cmd --add-port=3306/tcp --permanent firewall-cmd --add-port=33061/tcp --permanent firewall-cmd --reload验证集群状态
在MySQL Shell中执行以下命令确认集群状态正常:cluster.status()
内容的提问来源于stack exchange,提问作者sateesh
相关产品推荐
相关产品推荐

