新加节点事务,比原有mgr事务多

    1. 2021-11-20T15:26:18.542308+08:00 0 [ERROR] [MY-011526] [Repl] Plugin group_replication reported: 'This member has more executed transactions than those present in the group. Local transactions: 7bb79658-4906-11ec-9fd3-000c29714f8c:1, b7149998-4925-11ec-a287-000c291f841f:1-186, eacf48be-e333-460a-8607-1b353cdd9220:1-21 > Group transactions: b7149998-4925-11ec-a287-000c291f841f:1-187, eacf48be-e333-460a-8607-1b353cdd9220:1-29'

    通过binlog查看新加节点多出来的事务

    [root@localhost][(none)]: show binlog events in 'mysql-bin.000003';
    +------------------+------+----------------+-----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | Log_name         | Pos  | Event_type     | Server_id | End_log_pos | Info                                                                                                                                                                                                          |
    +------------------+------+----------------+-----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    | mysql-bin.000003 |    4 | Format_desc    |         3 |         125 | Server ver: 8.0.26, Binlog ver: 4                                                                                                                                                                             |
    | mysql-bin.000003 |  125 | Previous_gtids |         3 |         236 | b7149998-4925-11ec-a287-000c291f841f:1-186,
    eacf48be-e333-460a-8607-1b353cdd9220:1-21                                                                                                                         |
    | mysql-bin.000003 |  236 | Gtid           |         3 |         315 | SET @@SESSION.GTID_NEXT= '7bb79658-4906-11ec-9fd3-000c29714f8c:1'                                                                                                                                             |
    | mysql-bin.000003 |  315 | Query          |         3 |         386 | BEGIN                                                                                                                                                                                                         |
    | mysql-bin.000003 |  386 | Rows_query     |         3 |         440 | # delete from sysaux.dba_tables;                                                                                                                                                                              |
    | mysql-bin.000003 |  440 | Table_map      |         3 |         509 | table_id: 83 (sysaux.dba_tables)                                                                                                                                                                              |
    
    | mysql-bin.000003 | 1021 | Table_map      |         3 |        1090 | table_id: 83 (sysaux.dba_tables)                                                                                                                                                                              |
    | mysql-bin.000003 | 1090 | Write_rows     |         3 |        1375 | table_id: 83 flags: STMT_END_F                                                                                                                                                                                |
    | mysql-bin.000003 | 1375 | Xid            |         3 |        1406 | COMMIT /* xid=3 */                                                                                                                                                                                            |
    | mysql-bin.000003 | 1406 | Rotate         |         3 |        1453 | mysql-bin.000004;pos=4                                                                                                                                                                                        |
    +------------------+------+----------------+-----------+-------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    

    可以看到多出来的事务是一条delete语句

    如果不重要,则在主库跳过该事务
    set gtid_next = '7bb79658-4906-11ec-9fd3-000c29714f8c:1';
    begin;commit;
    set gtid_next = 'automatic';
    
    如果重要,再跳过该事务后,需要在每个节点手动执行
    主节点:
    set sql_log_bin=0;
    执行sql
    set sql_log_bin=1;
    
    从节点:
    set global super_read_only=0;
    set sql_log_bin=0;
    执行sql
    set sql_log_bin=1;
    set global super_read_only=1;
    

    执行完成后,再次加入

    start group_replication;