首页 > 数据库 >MySQL The instance is already part of another Replication Group

MySQL The instance is already part of another Replication Group

时间:2024-06-13 16:21:29浏览次数:32  
标签:06 TRANSACTION Group 55Z 33 Replication already 13T08 LAST

MySQL InnoDB Cluster(测试环境为MySQL 8.0.35)将一个实例重新加入集群时,遇到了下面这个错误"The instance 'dbu03:3306' is already part of another Replication Group"

MySQL  10.160.2.55:3306 ssl  JS > cluster.addInstance('[email protected]:3306')
ERROR: RuntimeError: The instance 'dbu03:3306' is already part of another Replication Group
Cluster.addInstance: The instance 'dbu03:3306' is already part of another Replication Group (RuntimeError)
MySQL  10.160.2.55:3306 ssl  JS > 

那么如何解决这个问题呢?官方文档介绍,碰到这种情况是遇到了一个Bug,可以通过mysql shell连接到这个实例(加入cluster遇到问题的实例,此案例为:10.160.2.62)

然后执行下面命令

shell.options.verbose=3
shell.options["dba.logSql"]=2
shell.options["logLevel"]=8
\sql
stop group_replication;
\js
dba.dropMetadataSchema();

实际执行过程如下所示:

 MySQL  10.160.2.62:3306 ssl  JS > shell.options.verbose=3
3
 MySQL  10.160.2.62:3306 ssl  JS > shell.options["dba.logSql"]=2
2
 MySQL  10.160.2.62:3306 ssl  JS > shell.options["logLevel"]=8
8
 MySQL  10.160.2.62:3306 ssl  JS > \sql
Switching to SQL mode... Commands end with ;
Fetching global names for auto-completion... Press ^C to stop.
stop group_replication; MySQL  10.16stop group_replication;
Query OK, 0 rows affected (0.0050 sec)
 MySQL  10.160.2.62:3306 ssl  SQL > \js
Switching to JavaScript mode...
 MySQL  10.160.2.62:3306 ssl  JS > \js
 MySQL  10.160.2.62:3306 ssl  JS > dba.dropMetadataSchema();
verbose: 2024-06-13T08:33:55Z: Connecting to MySQL at: mysql://[email protected]:3306?connect-timeout=5000
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: CONNECTED: 10.160.2.62:3306
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SET SESSION `autocommit` = 1
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SET SESSION `sql_mode` = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SET SESSION `group_replication_consistency` = 'EVENTUAL'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SET SESSION `collation_connection` = 'utf8mb4_0900_ai_ci'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SET SESSION `group_concat_max_len` = 1073741824
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SELECT COALESCE(@@report_host, @@hostname),  COALESCE(@@report_port, @@port)
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SELECT @@server_uuid
verbose: 2024-06-13T08:33:55Z: Metadata operations will use yictysspsdbu02:3306
verbose: 2024-06-13T08:33:55Z: Metadata operations will use yictysspsdbu02:3306
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata_bkp'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: select count(*) FROM performance_schema.replication_group_members WHERE MEMBER_ID = @@server_uuid AND MEMBER_STATE NOT IN ('OFFLINE', 'UNREACHABLE')
verbose: 2024-06-13T08:33:55Z: Instance type check: yictysspsdbu02:3306: GR is installed but not active
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SELECT
    c.channel_name, c.host, c.port, c.user,
    s.source_uuid, s.group_name, s.last_heartbeat_timestamp,
    s.service_state io_state, st.processlist_state io_thread_state,
    s.last_error_number io_errno, s.last_error_message io_errmsg,
    s.last_error_timestamp io_errtime,
    co.service_state co_state, cot.processlist_state co_thread_state,
    co.last_error_number co_errno, co.last_error_message co_errmsg,
    co.last_error_timestamp co_errtime,
    w.service_state w_state, wt.processlist_state w_thread_state,
    w.last_error_number w_errno, w.last_error_message w_errmsg,
    w.last_error_timestamp w_errtime,
    /*!80011 TIMEDIFF(NOW(6),
      IF(TIMEDIFF(s.LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP,
          s.LAST_HEARTBEAT_TIMESTAMP) >= 0,
        s.LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP,
        s.LAST_HEARTBEAT_TIMESTAMP
      )) as time_since_last_message,
    IF(s.LAST_QUEUED_TRANSACTION='' OR s.LAST_QUEUED_TRANSACTION=latest_w.LAST_APPLIED_TRANSACTION,
      'IDLE',
      'APPLYING') as applier_busy_state,
    IF(s.LAST_QUEUED_TRANSACTION='' OR s.LAST_QUEUED_TRANSACTION=latest_w.LAST_APPLIED_TRANSACTION,
      NULL,
      TIMEDIFF(latest_w.LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP,
        latest_w.LAST_APPLIED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP)
      ) as lag_from_original,
    IF(s.LAST_QUEUED_TRANSACTION='' OR s.LAST_QUEUED_TRANSACTION=latest_w.LAST_APPLIED_TRANSACTION,
      NULL,
      TIMEDIFF(latest_w.LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP,
        latest_w.LAST_APPLIED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP)
      ) as lag_from_immediate,
    */
    GTID_SUBTRACT(s.RECEIVED_TRANSACTION_SET, @@global.gtid_executed)
      as queued_gtid_set_to_apply
  FROM performance_schema.replication_connection_configuration c
  JOIN performance_schema.replication_connection_status s
    ON c.channel_name = s.channel_name
  LEFT JOIN performance_schema.replication_applier_status_by_coordinator co
    ON c.channel_name = co.channel_name
  JOIN performance_schema.replication_applier_status a
    ON c.channel_name = a.channel_name
  JOIN performance_schema.replication_applier_status_by_worker w
    ON c.channel_name = w.channel_name
  LEFT JOIN
  /* if parallel replication, fetch owner of most recently applied tx */
    (SELECT *
      FROM performance_schema.replication_applier_status_by_worker
      /*!80011 ORDER BY LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP DESC */
      LIMIT 1) latest_w
    ON c.channel_name = latest_w.channel_name
  LEFT JOIN performance_schema.threads st
    ON s.thread_id = st.thread_id
  LEFT JOIN performance_schema.threads cot
    ON co.thread_id = cot.thread_id
  LEFT JOIN performance_schema.threads wt
    ON w.thread_id = wt.thread_id
ORDER BY channel_name
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW SLAVE HOSTS
verbose: 2024-06-13T08:33:55Z: Refreshing metadata cache from 'yictysspsdbu02:3306'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata_bkp'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata_bkp'
verbose: 2024-06-13T08:33:55Z: DONE!
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW DATABASES LIKE 'mysql_innodb_cluster_metadata_bkp'
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: select count(*) FROM performance_schema.replication_group_members WHERE MEMBER_ID = @@server_uuid AND MEMBER_STATE NOT IN ('OFFLINE', 'UNREACHABLE')
verbose: 2024-06-13T08:33:55Z: Instance type check: yictysspsdbu02:3306: GR is installed but not active
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SELECT
    c.channel_name, c.host, c.port, c.user,
    s.source_uuid, s.group_name, s.last_heartbeat_timestamp,
    s.service_state io_state, st.processlist_state io_thread_state,
    s.last_error_number io_errno, s.last_error_message io_errmsg,
    s.last_error_timestamp io_errtime,
    co.service_state co_state, cot.processlist_state co_thread_state,
    co.last_error_number co_errno, co.last_error_message co_errmsg,
    co.last_error_timestamp co_errtime,
    w.service_state w_state, wt.processlist_state w_thread_state,
    w.last_error_number w_errno, w.last_error_message w_errmsg,
    w.last_error_timestamp w_errtime,
    /*!80011 TIMEDIFF(NOW(6),
      IF(TIMEDIFF(s.LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP,
          s.LAST_HEARTBEAT_TIMESTAMP) >= 0,
        s.LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP,
        s.LAST_HEARTBEAT_TIMESTAMP
      )) as time_since_last_message,
    IF(s.LAST_QUEUED_TRANSACTION='' OR s.LAST_QUEUED_TRANSACTION=latest_w.LAST_APPLIED_TRANSACTION,
      'IDLE',
      'APPLYING') as applier_busy_state,
    IF(s.LAST_QUEUED_TRANSACTION='' OR s.LAST_QUEUED_TRANSACTION=latest_w.LAST_APPLIED_TRANSACTION,
      NULL,
      TIMEDIFF(latest_w.LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP,
        latest_w.LAST_APPLIED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP)
      ) as lag_from_original,
    IF(s.LAST_QUEUED_TRANSACTION='' OR s.LAST_QUEUED_TRANSACTION=latest_w.LAST_APPLIED_TRANSACTION,
      NULL,
      TIMEDIFF(latest_w.LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP,
        latest_w.LAST_APPLIED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP)
      ) as lag_from_immediate,
    */
    GTID_SUBTRACT(s.RECEIVED_TRANSACTION_SET, @@global.gtid_executed)
      as queued_gtid_set_to_apply
  FROM performance_schema.replication_connection_configuration c
  JOIN performance_schema.replication_connection_status s
    ON c.channel_name = s.channel_name
  LEFT JOIN performance_schema.replication_applier_status_by_coordinator co
    ON c.channel_name = co.channel_name
  JOIN performance_schema.replication_applier_status a
    ON c.channel_name = a.channel_name
  JOIN performance_schema.replication_applier_status_by_worker w
    ON c.channel_name = w.channel_name
  LEFT JOIN
  /* if parallel replication, fetch owner of most recently applied tx */
    (SELECT *
      FROM performance_schema.replication_applier_status_by_worker
      /*!80011 ORDER BY LAST_APPLIED_TRANSACTION_END_APPLY_TIMESTAMP DESC */
      LIMIT 1) latest_w
    ON c.channel_name = latest_w.channel_name
  LEFT JOIN performance_schema.threads st
    ON s.thread_id = st.thread_id
  LEFT JOIN performance_schema.threads cot
    ON co.thread_id = cot.thread_id
  LEFT JOIN performance_schema.threads wt
    ON w.thread_id = wt.thread_id
ORDER BY channel_name
verbose: 2024-06-13T08:33:55Z: Dba.dropMetadataSchema: tid=530: SQL: SHOW SLAVE HOSTS
Dba.dropMetadataSchema: This function is not available through a session to a standalone instance (MYSQLSH 51300)
 MySQL  10.160.2.62:3306 ssl  JS > 

如果上面命令没有成功,那么我们就必须连接到数据库,手工执行下面命令

stop group_replication;
drop schema mysql_innodb_cluster_metadata;

然后在主节点执行下面命令,就可以重新将实例加入MySQL InnoDB Cluster。

var cluster=dba.getCluster()
cluster.addInstance('[email protected]:3306')
cluster.status()

关于这个问题,官方文档The instance 'mysqlNode:3306' is already part of another Replication Group, How To Solve? (Doc ID 2809308.1)[1] 中介绍,是因为遇到了Bug #33294010 clusterset: rejoinInstance() on broken GR member fail[2] 如下截图所示,这个Bug在8.1.0中已经Fix掉了。

参考资料

[1]

1: https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=425530417327847&id=2809308.1&_afrWindowMode=0&_adf.ctrl-state=3s7yvgwzw_4

[2]

2: https://support.oracle.com/epmos/faces/BugDisplay?_afrLoop=426942735497044&id=33294010&_afrWindowMode=0&_adf.ctrl-state=3s7yvgwzw_53

标签:06,TRANSACTION,Group,55Z,33,Replication,already,13T08,LAST
From: https://www.cnblogs.com/kerrycode/p/18246155

相关文章

  • mysql中group by 的用法解析
    1.groupby的常规用法groupby的常规用法是配合聚合函数,利用分组信息进行统计,常见的是配合max等聚合函数筛选数据后分析,以及配合having进行筛选后过滤。假设现有数据库表如下:表user_info,id主键,user_id唯一键CREATETABLE`user_info`(`id`INT(11)NOTNULLAUTO......
  • 过滤条件之分组 group by、having、distinct、order by、limit、正则、多表查询和子查
    【一】过滤条件之分组groupby【1】引入--按照指定条件对所有数据进行分组--对员工进行分组按照年龄/部门--...select*from*where*groupby*;【2】按照部门分组(1)查询数据select*fromempgroupbypost;#第一次使用部门分组会报错mysql>select*f......
  • 【FreeRTOS】事件组 event group(附源码)
    引言:事件组是一种用于同步多个任务之间的状态和行为的机制。在操作系统中,事件组通常由操作系统提供,用于实现任务间的通信和同步。事件组通常包含一组独立的事件或标志,每个事件或标志都可以表示一种特定的状态或条件。任务可以等待事件组中的一个或多个事件被设置,也可以设置、......
  • WPF GroupStyle GroupStyle.HeaderTemplate
    //xaml<Windowx:Class="WpfApp148.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.mi......
  • Python基础操作之模块 -- pandas之groupby函数
            groupby函数是pandas库中一个非常强大的功能,它允许你根据一个或多个列的值对DataFrame或Series进行分组,并对每个组执行各种聚合操作。目录示例详解1.导入必要的库和创建DataFrame2.使用groupby函数进行分组3.遍历分组并查看内容4.对分组执行聚合操作......
  • MySQL GROUP BY 用法介绍
    MySQL中GROUPBY用法简介GROUPBY语句用于结合合计函数,根据一个或多个列对结果集进行分组。可以把分组理解成Excel中的分组。把合计函数理解成Excel中的求和、求平均值等。语法SELECTcolumn1,column2,aggregate_function(column3)FROMtable_nameWHEREcon......
  • View->Bitmap缩放到自定义ViewGroup的任意区域(RectF方式绘制Bitmap)
    XML文件<?xmlversion="1.0"encoding="utf-8"?><LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent&quo......
  • WPF RenderTransform TransformGroup ScaleTransform TranslateTransform
    <Windowx:Class="WpfApp132.MainWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft......
  • ### Cause: java.sql.SQLSyntaxErrorException: Expression #4 of SELECT list is not
    最近把线上数据库备份到本地数据库进行一些代码修改时候,发现代码连接本地数据库报错,线上数据库是正常的,后来查阅了一下是SELECT列表不在GROUPBY语句内且存在不函数依赖GROUPBY语句的非聚合字段,算是比较严谨的sql模式,如果需要解决的话需要修改一下my.ini配置页面,我先去自己安装......
  • 【Xilinx约束】使用set_clock_groups 约束语法处理异步时钟域
            在XilinxVivado环境中,set_clock_groups约束用于定义时钟组,以确保工具在布局和布线时考虑时钟之间的关联性。这对于跨时钟域的设计和时序优化非常重要。                使用set_clock_groups约束语法处理异步时钟域有不同的方式,适用于不......