MySQL Shell无法拉起MGR集群解决办法

用MySQL Shell要重新拉起一个MGR集群时,可能会提示下面的错误信息:

Dba.rebootClusterFromCompleteOutage: Unable to get an InnoDB cluster handle. The instance '172.16.130.197:3306' may belong to a different cluster from the one registered in the Metadata since the value of 'group_replication_group_name' does not match the one registered in the Metadata: possible split-brain scenario. Please retry while connected to another member of the cluster. (RuntimeError)

意思是该节点属于其他MGR集群(从元数据读取到的 group_replication_group_name 值判断的),因此不能直接拉起。

这种错误常见于MySQL 5.7版本构建的MGR集群环境下,如果是运行MySQL 8.0的话则一般很少见。

之所以会这样,是因为MySQL 5.7中还不支持 SET PERSIST 功能。

在MySQL 8.0中,用MySQL Shell构建MGR集群时,会随机生成一个UUID作为 group_replication_group_name,并以 SET PERSIST 的方式持久化(保存到 mysqld-auto.cnf 文件中),实例重启时还能继续读取。

而在MySQL 5.7中,因为没有这个功能,实例重启时还会从原来的 my.cnf 中读取旧的 group_replication_group_name 值,导致被判断为该节点属于另一个集群。

现在已经知道问题的原因了,解决办法也简单。

  1. 获取正确的 group_replication_group_name

    实例重启完成后,读取 mysql_innodb_cluster_metadata.clusters 这个元数据表,获取正确的 group name。
mysql> select attributes->'$.group_replication_group_name' from clusters;
+----------------------------------------------+
| attributes->'$.group_replication_group_name' |
+----------------------------------------------+
| "bc664a9b-9b5b-11ec-8a73-525400c5601a" |
+----------------------------------------------+
  1. 在每个节点上手动修改 group_replication_group_name
mysql> set global group_replication_group_name = "bc664a9b...";
  1. 再次执行 dba.rebootClusterFromCompleteOutage() 就行了。
 MySQL  172.16.130.197:3306 ssl  JS > dba.rebootClusterFromCompleteOutage()
Restoring the default cluster from complete outage...

Enjoy GreatSQL

本文由博客一文多发平台 OpenWrite 发布!

最新文章

  1. ORA-12514 TNS:listener does not currently know of service requested in connect descriptor
  2. GJM : 【C# 高性能服务器】完成端口、心跳的高性能Socket服务器 [转载]
  3. LINK : fatal error LNK1104: 无法打开文件“LIBCD.lib”
  4. C++语言-02-函数
  5. Java-httpClient警告: Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
  6. 游戏开发Camera之Cinematic Camera-深度
  7. 2015年6月股灾永远载入A股史册
  8. PHP学习笔记6-时间/日期
  9. IOS之【属性列表】
  10. Linux学习笔记——举例说,makefile 添加宏定义
  11. EntityFramework Core饥饿加载忽略导航属性问题
  12. 解决unbuntu14.04上的eclipse自动退出的问题
  13. mssql sqlserver 不固定行转列数据(动态列)
  14. oracle性能优化之awr分析
  15. Jquery 扩展方法实现原理
  16. ensureCapacity增加此 ArrayList 实例的容量,以确保它至少能够容纳最小容量参数所指定的元素数。
  17. Python (time、datetime、random、os、sys、shutil)模块的使用
  18. ReactiveX 学习笔记(20)使用 RxJava + RxBinding 进行 GUI 编程
  19. attenuation
  20. 【Python】Python 打印和输出更多用法。

热门文章

  1. MySQL启动与多实例安装
  2. 亿信BI——维度转换组件使用
  3. python之模块(hashlib、logging)
  4. AR Engine运动跟踪能力,高精度实现沉浸式AR体验
  5. 物联网lora无线数传模块应用案例:LoRawan网关通信技术
  6. synchronized下的 i+=2 和 i++ i++执行结果居然不一样
  7. Java上传文件至SFTP服务器
  8. javascript写淡入淡出效果的轮播图
  9. SAP 实例 3 Context Menus
  10. Maven-打包jar指定main函数所在类的一个例子