MySQL主从复制重新初始化单表或者单库的方法

news2024/11/15 8:37:37
作者介绍:老苏,10余年DBA工作运维经验,擅长Oracle、MySQL、PG、Mongodb数据库运维(如安装迁移,性能优化、故障应急处理等)
公众号:老苏畅谈运维
欢迎关注本人公众号,更多精彩与您分享。

背景说明

在很多情况下,由于一张表或几张表的数据不一致导致主从复制中断,或者在搭建从库时,发现漏掉了某些库或者表。如果数据量较大,重新搭建一个从库耗时会较长。那么有没有办法只针对有问题的表或者漏掉的库重新初始化,从而恢复主从同步呢?

当然是有方法的,针对表的恢复操作有以下几种可行的方式:

  • 在主库锁定这张表做可传输表空间还原到从库
  • 在主库锁定这张表导出数据导入到从库
  • 使用备份恢复工具实现从库同步恢复

前面2种方法需要在导出数据过程中,需要进行锁表,考虑到对生产的影响尽可能减少,选择第三种方法来进行恢复。

环境说明

IP角色需初始的表
192.168.6.13主库sbtest库下的sbtest1、sbtest2
192.168.6.14从库sbtest库下的sbtest1、sbtest2

表的初始化恢复步骤

模拟从库出现表不一致

对主库进行加压测试数据

sysbench /usr/share/sysbench/oltp_read_write.lua --mysql-host=192.168.6.13 --mysql-port=3306 --mysql-user=root --mysql-password='root@MySQL888' --mysql-db=sbtest --db-driver=mysql \
--tables=10 --table-size=1000 --report-interval=10 --threads=4 --time=600 --db-ps-mode=disable --max-requests=0 --percentile=95  run

加压过程中,删除从库的表sbtest1和sbtest2

(root@localhost)[sbtest]20:00>show tables;
+------------------+
| Tables_in_sbtest |
+------------------+
| sbtest1          |
| sbtest10         |
| sbtest2          |
| sbtest3          |
| sbtest4          |
| sbtest5          |
| sbtest6          |
| sbtest7          |
| sbtest8          |
| sbtest9          |
+------------------+
10 rows in set (0.00 sec)

(root@localhost)[sbtest]20:01>drop table sbtest1;
Query OK, 0 rows affected (0.02 sec)

(root@localhost)[sbtest]20:01>drop table sbtest2;
Query OK, 0 rows affected (0.00 sec)

从库同步报错

--同步状态

(root@localhost)[sbtest]20:01>show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000038
          Read_Master_Log_Pos: 103341043
               Relay_Log_File: relay.000087
                Relay_Log_Pos: 8172423
        Relay_Master_Log_File: binlog.000038
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1146
                   Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 3 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:936591' at master log binlog.000038, end_log_pos 88970909. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

--日志显示找不到表sbtest.sbtest1
2024-08-23T20:01:31.543732+08:00 114 [ERROR] [MY-010584] [Repl] Slave SQL for channel '': Worker 2 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:936590' at master log binlog.000038, end_log_pos 88968604; Error executing row event: 'Table 'sbtest.sbtest1' doesn't exist', Error_code: MY-001146
2024-08-23T20:01:31.544719+08:00 115 [ERROR] [MY-010584] [Repl] Slave SQL for channel '': Worker 3 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:936591' at master log binlog.000038, end_log_pos 88970909; Error executing row event: 'Table 'sbtest.sbtest1' doesn't exist', Error_code: MY-001146
2024-08-23T20:01:31.545923+08:00 112 [Warning] [MY-010584] [Repl] Slave SQL for channel '': ... The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state. A restart should restore consistency automatically, although using non-transactional storage for data or info tables or DDL queries could lead to problems. In such cases you have to examine your data (see documentation for details). Error_code: MY-001756

从库停止复制进程

(root@localhost)[sbtest]20:03>stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

(root@localhost)[sbtest]20:03>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000038
          Read_Master_Log_Pos: 198568806
               Relay_Log_File: relay.000087
                Relay_Log_Pos: 8172423
        Relay_Master_Log_File: binlog.000038
             Slave_IO_Running: No
            Slave_SQL_Running: No

主库单独备份有问题的表(一致性备份)

一致性备份

mysqldump -uroot -proot@MySQL888 -h 192.168.6.13 --single-transaction --master-data=2 --flush-logs sbtest sbtest1 sbtest2 > t.sql

查看备份文件记录的pos、gtid信息

cat t.sql 

SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '86f14188-54fe-11ed-9f7a-0242c0a8060d:1-994227';

--
-- Position to start replication or point-in-time recovery from
--

-- CHANGE MASTER TO MASTER_LOG_FILE='binlog.000039', MASTER_LOG_POS=196;

从库导入数据

(root@localhost)[sbtest]20:04>show tables;
+------------------+
| Tables_in_sbtest |
+------------------+
| sbtest10         |
| sbtest3          |
| sbtest4          |
| sbtest5          |
| sbtest6          |
| sbtest7          |
| sbtest8          |
| sbtest9          |
+------------------+
8 rows in set (0.00 sec)

(root@localhost)[sbtest]20:05>source t.sql
(root@localhost)[sbtest]20:05>show tables;
+------------------+
| Tables_in_sbtest |
+------------------+
| sbtest1          |
| sbtest10         |
| sbtest2          |
| sbtest3          |
| sbtest4          |
| sbtest5          |
| sbtest6          |
| sbtest7          |
| sbtest8          |
| sbtest9          |
+------------------+
10 rows in set (0.00 sec)

从库开启复制过滤

设置复制过滤,并指定UNTIL SQL_BEFORE_GTIDS

CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE=('sbtest.sbtest1','sbtest.sbtest2');

## UNTIL SQL_BEFORE_GTIDS指定的GTID值为备份文件中的GTID值+1
## 86f14188-54fe-11ed-9f7a-0242c0a8060d:994227 +1
## 注意指定结束点即可,无需指定开始点(不需要1-994228这种形式,只要994228)
start slave UNTIL SQL_BEFORE_GTIDS='86f14188-54fe-11ed-9f7a-0242c0a8060d:994228';

--start slave  SQL_THREAD  UNTIL   SQL_BEFORE_GTIDS='86f14188-54fe-11ed-9f7a-0242c0a8060d:994228'

或通过指定pos信息
start slave until MASTER_LOG_FILE='binlog.000039',MASTER_LOG_POS=196;

(root@localhost)[(none)]20:09>CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE=('sbtest.sbtest1','sbtest.sbtest2');
Query OK, 0 rows affected (0.00 sec)

(root@localhost)[(none)]20:09>show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: 
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000038
          Read_Master_Log_Pos: 198568806
               Relay_Log_File: relay.000087
                Relay_Log_Pos: 8172423
        Relay_Master_Log_File: binlog.000038
             Slave_IO_Running: No
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: sbtest.sbtest1,sbtest.sbtest2

(root@localhost)[(none)]20:09>start slave UNTIL SQL_BEFORE_GTIDS='86f14188-54fe-11ed-9f7a-0242c0a8060d:994228';
Query OK, 0 rows affected, 1 warning (0.01 sec)

(root@localhost)[(none)]20:10>show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000039
          Read_Master_Log_Pos: 122237428
               Relay_Log_File: relay.000090
                Relay_Log_Pos: 405
        Relay_Master_Log_File: binlog.000039
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: sbtest.sbtest1,sbtest.sbtest2
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 196
              Relay_Log_Space: 122237920
              Until_Condition: SQL_BEFORE_GTIDS
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 330613
                  Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060d
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: 
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:634558-1047246
            Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-994227,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-20
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.01 sec)


###可以看到同步这个gtid:86f14188-54fe-11ed-9f7a-0242c0a8060d:1-994227 就自动停止。

取消过滤,重新开启复制

待数据同步到GTID:994227点后会自动停止,重新配置过滤规则取消后复制恢复正常

stop slave;
CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE=();
start slave;

(root@localhost)[(none)]20:11>stop slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

(root@localhost)[(none)]20:11>CHANGE REPLICATION FILTER REPLICATE_WILD_IGNORE_TABLE=();
Query OK, 0 rows affected (0.00 sec)

(root@localhost)[(none)]20:11>start slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)

(root@localhost)[(none)]20:12>show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000039
          Read_Master_Log_Pos: 122238144
               Relay_Log_File: relay.000091
                Relay_Log_Pos: 807
        Relay_Master_Log_File: binlog.000039
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 122238144
              Relay_Log_Space: 122238845
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 330613
                  Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060d
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:634558-1047248
            Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1047248,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-20
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.01 sec)

库的初始化恢复步骤

针对某个库的初始化和表的初始化,步骤大体相似(不同地方就是在导出的时候针对库导出,后面用 CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB=(sbtest) 来进行过滤库)。

模拟从库出现库不一致

对主库进行加压测试数据

sysbench /usr/share/sysbench/oltp_read_write.lua --mysql-host=192.168.6.13 --mysql-port=3306 --mysql-user=root --mysql-password='root@MySQL888' --mysql-db=sbtest --db-driver=mysql \
--tables=10 --table-size=1000 --report-interval=10 --threads=4 --time=600 --db-ps-mode=disable --max-requests=0 --percentile=95  run

加压过程中,删除从库的sbtest库

(root@localhost)[(none)]21:15>show databases;
+-----------------------+
| Database              |
+-----------------------+
| 192_168_6_13_3306_aaa |
| aaa                   |
| inception             |
| information_schema    |
| mydb                  |
| mysql                 |
| ora_backup            |
| performance_schema    |
| sbtest                |
| sys                   |
+-----------------------+
10 rows in set (0.00 sec)

(root@localhost)[(none)]21:16>drop database sbtest;
Query OK, 10 rows affected (0.08 sec)

(root@localhost)[(none)]21:16>show databases;
+-----------------------+
| Database              |
+-----------------------+
| 192_168_6_13_3306_aaa |
| aaa                   |
| inception             |
| information_schema    |
| mydb                  |
| mysql                 |
| ora_backup            |
| performance_schema    |
| sys                   |
+-----------------------+
9 rows in set (0.01 sec)

从库同步报错

(root@localhost)[(none)]21:17>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000040
          Read_Master_Log_Pos: 67009395
               Relay_Log_File: relay.000091
                Relay_Log_Pos: 11750613
        Relay_Master_Log_File: binlog.000039
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 1049
                   Last_Error: Coordinator stopped because there were error(s) in the worker(s). The most recent failure being: Worker 1 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:1052495' at master log binlog.000039, end_log_pos 134212310. See error log and/or performance_schema.replication_applier_status_by_worker table for more details about this failure or others, if any.

2024-08-23T21:16:11.664410+08:00 129 [ERROR] [MY-010584] [Repl] Slave SQL for channel '': Worker 3 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:1052497' at master log binlog.000039, end_log_pos 134216920; Error executing row event: 'Unknown database 'sbtest'', Error_code: MY-001049
2024-08-23T21:16:11.664722+08:00 128 [ERROR] [MY-010584] [Repl] Slave SQL for channel '': Worker 2 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:1052496' at master log binlog.000039, end_log_pos 134214615; Error executing row event: 'Unknown database 'sbtest'', Error_code: MY-001049
2024-08-23T21:16:11.672727+08:00 127 [ERROR] [MY-010584] [Repl] Slave SQL for channel '': Worker 1 failed executing transaction '86f14188-54fe-11ed-9f7a-0242c0a8060d:1052495' at master log binlog.000039, end_log_pos 134212310; Error executing row event: 'Unknown database 'sbtest'', Error_code: MY-001049
2024-08-23T21:16:11.675160+08:00 126 [ERROR] [MY-010586] [Repl] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000039' position 133987950

从库停止复制进程

(root@localhost)[(none)]21:19>stop slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)

主库备份有问题的库(一致性备份)

mysqldump -uroot -proot@MySQL888 -h 192.168.6.13 --single-transaction --master-data=2 --flush-logs sbtest  > db.sql

查看备份文件记录的pos、gtid信息

SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1064457';

--
-- Position to start replication or point-in-time recovery from
--

-- CHANGE MASTER TO MASTER_LOG_FILE='binlog.000040', MASTER_LOG_POS=196;

从库导入数据

(root@localhost)[(none)]21:22>create database sbtest;
Query OK, 1 row affected (0.02 sec)

(root@localhost)[(none)]21:22>use sbtest;
Database changed
(root@localhost)[sbtest]21:22>source db.sql;
(root@localhost)[sbtest]21:23>show tables;
+------------------+
| Tables_in_sbtest |
+------------------+
| sbtest1          |
| sbtest10         |
| sbtest2          |
| sbtest3          |
| sbtest4          |
| sbtest5          |
| sbtest6          |
| sbtest7          |
| sbtest8          |
| sbtest9          |
+------------------+
10 rows in set (0.00 sec)

从库开启复制过滤

设置复制过滤,并指定UNTIL SQL_BEFORE_GTIDS

CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB=(sbtest);

## UNTIL SQL_BEFORE_GTIDS指定的GTID值为备份文件中的GTID值+1
## 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1064457 +1
## 注意指定结束点即可,无需指定开始点(不需要1-1064457这种形式,只要1064458)
start slave UNTIL SQL_BEFORE_GTIDS='86f14188-54fe-11ed-9f7a-0242c0a8060d:1064458';

--start slave  SQL_THREAD  UNTIL   SQL_BEFORE_GTIDS='86f14188-54fe-11ed-9f7a-0242c0a8060d:1064458'

或通过指定pos信息
start slave until MASTER_LOG_FILE='binlog.000040',MASTER_LOG_POS=196;

(root@localhost)[sbtest]21:23>CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB=(sbtest);
Query OK, 0 rows affected (0.00 sec)

(root@localhost)[(none)]21:42>start slave UNTIL SQL_BEFORE_GTIDS='86f14188-54fe-11ed-9f7a-0242c0a8060d:1064458';
Query OK, 0 rows affected, 1 warning (0.01 sec)

(root@localhost)[(none)]21:43>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Queueing source event to the relay log
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000040
          Read_Master_Log_Pos: 514040758
               Relay_Log_File: relay.000097
                Relay_Log_Pos: 405
        Relay_Master_Log_File: binlog.000040
             Slave_IO_Running: Yes
            Slave_SQL_Running: No
              Replicate_Do_DB: 
          Replicate_Ignore_DB: sbtest
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 196
              Relay_Log_Space: 514041475
              Until_Condition: SQL_BEFORE_GTIDS
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 330613
                  Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060d
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: 
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1052495-1287353
            Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1064457,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-22
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.00 sec)
###可以看到同步这个gtid:86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1064457 就自动停止。

取消过滤,重新开启复制

待数据同步到GTID:1064457点后会自动停止,重新配置过滤规则取消后复制恢复正常

stop slave;
CHANGE REPLICATION FILTER REPLICATE_IGNORE_DB=();
start slave;

查看同步情况

(root@localhost)[(none)]21:50>show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for source to send event
                  Master_Host: 192.168.6.13
                  Master_User: svr_slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000040
          Read_Master_Log_Pos: 569068103
               Relay_Log_File: relay.000098
                Relay_Log_Pos: 1881
        Relay_Master_Log_File: binlog.000040
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 569068103
              Relay_Log_Space: 569068804
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 330613
                  Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060d
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1052495-1311285
            Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1311285,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-22
                Auto_Position: 1
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

在这里插入图片描述

关注我,学习更多的数据库知识!
请添加图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2067771.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【C++ Primer Plus习题】3.7

问题: 解答: #include <iostream> using namespace std;const float GALLO_TO_LITRE 3.785; const float KM_TO_MILE 62.14;int main() {float litre 0;float gallo 0;float mile 0;cout << "请输入汽车油耗(每100km消耗的汽油量单位为升):";cin &…

C#下在派生类中引发基类事件的方法与示例

文章目录 基类事件在派生类中的定义及触发方式基类事件的传播机制示例总结 在面向对象编程中&#xff0c;继承是代码复用的一种重要方式。C#作为一种面向对象的编程语言&#xff0c;允许派生类继承基类的属性和方法。基类定义了一系列共有的属性和行为&#xff0c;而派生类则可…

【UE】尝试一种老派的平面假反射做法,与进一步改进效果的思路

在实践中&#xff0c;常常需要为类似荧幕&#xff0c;LED广告牌等平面制作反射。 但会遇到各种问题&#xff0c;例如在使用屏幕空间反射时&#xff0c;平面必须在画面内 平面反射捕获与光线追踪又代价高昂 因此&#xff0c;在一些情况下依然会使用一种历史悠久的反射手法 这种…

树(二叉树)

树 1.1 特性 1.1.1 什么是树 树(Tree)是(n>0)个节点的有限集合T&#xff0c;它满足两个条件&#xff1a; (1) 有且仅有一个特定的称为根&#xff08;Root&#xff09;的节点。 其余的节点可以分为m&#xff08;m≥0&#xff09;个互不相交的有限集合T1、T2、……、Tm&#x…

【Docker】Linux系统以及威联通QNAP部署思源笔记的通用教程

本文首发于 ❄️慕雪的寒舍 本文测试的是旧版本v2.11.4的部署方式&#xff0c;实测当前&#xff08;2024.08.15&#xff09;最新的v3.1.3版本也可以用相同的方式部署。本文的部署方式共写了三种&#xff0c;非qnap的linux系统也可以参考本文部署思源笔记。 阅读本文之前&#…

SpringBoot 集成积木报表

SpringBoot 集成积 前言 积木报表是jeecg的一款开源但代码不开源的一款自定义报表&#xff0c;可以基于网页灵活 调整报表的布局、样式等内容&#xff0c;无需编程&#xff0c;专为企业数据分析、报表制作而设计&#xff1b; 降低管理人员汇总制作报表的门槛&#xff0c;解决…

在表格上,按照单元格数值显示单元格背景进度条

想要实现的效果如下&#xff1a; 单元格背景进度条的大小取决于当前单元格里的数值 TreeList和GridControl的设置方法都是相同的&#xff1a;都是通过给列设置FormatRule来实现的。 相关代码及设置如下&#xff1a; 1、给控件绑定数据源&#xff0c;我的数据源是一个DataTab…

25届网安秋招,信息泄露常问之配置信息泄露

吉祥知识星球http://mp.weixin.qq.com/s?__bizMzkwNjY1Mzc0Nw&mid2247485367&idx1&sn837891059c360ad60db7e9ac980a3321&chksmc0e47eebf793f7fdb8fcd7eed8ce29160cf79ba303b59858ba3a6660c6dac536774afb2a6330#rd 《网安面试指南》http://mp.weixin.qq.com/s?…

基于STM32开发的智能花园灌溉系统

目录 引言环境准备工作 硬件准备软件安装与配置系统设计 系统架构硬件连接代码实现 系统初始化土壤湿度监测与处理灌溉控制与状态指示Wi-Fi通信与远程监控应用场景 家庭花园智能灌溉农业田地的智能灌溉管理常见问题及解决方案 常见问题解决方案结论 1. 引言 随着智能家居技术…

录屏神器!一键搞定视频录制,小白也能轻松上手

在工作当中录制会议内容或者看电影录制精彩瞬间、学习时录制网课的重点部分等等都是需要借助可以实现屏幕录制的工具&#xff0c;让我们的日常更加精彩并且有回忆的记录&#xff0c;今天就来给大家整理了四款好用的录屏工具&#xff0c;实现保存高清、流畅的电脑屏幕的精彩记录…

重定向

重定向原理 #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> int main() { close(1); int fd open("myfile", O_WRONLY|O_CREAT, 00644); if(fd < 0){ perror("o…

V-ASSISTANT软件无法设置V90伺服软限位

使用V-ASSISTANT软件配置V90伺服参数时&#xff0c;软限位功能是灰色且未勾选&#xff0c;无法设置软限位&#xff0c;如下图所示&#xff1a; 原因&#xff1a;设置零点位置之后需要在PLC中激活软限位&#xff08;如FB284中ConfigEPOS管脚的Bit2&#xff09; FB284中的Confi…

python学习之路 - pyecharts快速入门

目录 一、pyecharts入门1、pyecharts模块介绍a、概况 2、pyecharts基础入门&#xff08;以折线图为例&#xff09;a、安装依赖b、创建折线图c、常用配置项 3、pyecharts创建柱状图a、创建基本柱状图b、创建反转柱状图c、创建含有时间线的柱状图 4、pyecharts地图可视化a、生成中…

WSL-ubuntu下载安装配置cudnn

下载 安装cuDnn的话需要和CUDA版本对应&#xff0c;可参考官网&#xff1a; cuDNN Archive | NVIDIA Developer 我的cuda是11.8 这个cuDNN8.9.7_Linux直接下载&#xff1a; https://developer.nvidia.com/downloads/compute/cudnn/secure/8.9.7/local_installers/11.x/cudn…

无人机技术的最新进展及未来趋势

一、飞行控制技术的提升 复杂环境下的稳定性&#xff1a;现代无人机在飞行控制系统方面的升级&#xff0c;使其能在复杂环境中稳定飞行&#xff0c;例如强风条件下或狭窄空间内。 智能避障系统&#xff1a;新型无人机配备有高精度的传感器和先进的算法&#xff0c;能够实现自…

vue3快速入门(一)新建项目与安装插件

步骤很详细&#xff0c;直接上教程 在对应路径下&#xff0c;cmd输入npm create vuelatest,然后按图所示进行选择&#xff08;仅供新手参考&#xff09; 安装以下插件 3.重启vscode&#xff08;为了确保插件生效&#xff09; 4.在vscode启动内置终端 输入npm i或pnpm i安装依赖…

浅谈 mysql 单、双引号的3种用法

mysql 单引号和双引号的使用&#xff0c;主要有以下3种情形 1、在引用字符型或日期类型的值时使用。 2、使用 as 创建别名时使用&#xff0c;别名如含特殊字符&#xff0c;则必须使用单引号或双引号。 3、解决数据原文中存在的单双引号问题。 注&#xff1a;本文所指的单、…

【Docker】Docker学习01 | 什么是docker?

本文首发于 ❄️慕雪的寒舍 因为本人没有学习过docker&#xff0c;虽然部署过很多镜像&#xff0c;但是对于docker底层的实现一概不知。趁学习一个新项目的契机&#xff0c;将docker的相关概念了解清楚。 安装docker的教程请查看 Linux主机安装docker。 如果你想和我一起学习do…

内存管理篇-02内存硬件电路和接口

1. 内存硬件实现机制 通过D触发器构建寄存器和内存的结构对比,这里主要先表达sram复杂&#xff0c;dram简单。 2. sram和ddr sdram结构图对比 主要是想对比sram和dram在和CPU连接过程的差异。sram需要的地址线较多&#xff0c;dram需要的较少&#xff0c;但是需要多次发送&…

如何用Python进行民宿数据分析?可视化工具应用教程

&#x1f393; 作者&#xff1a;计算机毕设小月哥 | 软件开发专家 &#x1f5a5;️ 简介&#xff1a;8年计算机软件程序开发经验。精通Java、Python、微信小程序、安卓、大数据、PHP、.NET|C#、Golang等技术栈。 &#x1f6e0;️ 专业服务 &#x1f6e0;️ 需求定制化开发源码提…