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

2024-08-24 00:04

本文主要是介绍MySQL主从复制重新初始化单表或者单库的方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

作者介绍:老苏,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 eventMaster_Host: 192.168.6.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000038Read_Master_Log_Pos: 103341043Relay_Log_File: relay.000087Relay_Log_Pos: 8172423Relay_Master_Log_File: binlog.000038Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1146Last_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.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000038Read_Master_Log_Pos: 198568806Relay_Log_File: relay.000087Relay_Log_Pos: 8172423Relay_Master_Log_File: binlog.000038Slave_IO_Running: NoSlave_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.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000038Read_Master_Log_Pos: 198568806Relay_Log_File: relay.000087Relay_Log_Pos: 8172423Relay_Master_Log_File: binlog.000038Slave_IO_Running: NoSlave_SQL_Running: NoReplicate_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 eventMaster_Host: 192.168.6.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000039Read_Master_Log_Pos: 122237428Relay_Log_File: relay.000090Relay_Log_Pos: 405Relay_Master_Log_File: binlog.000039Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: sbtest.sbtest1,sbtest.sbtest2Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 196Relay_Log_Space: 122237920Until_Condition: SQL_BEFORE_GTIDSUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 330613Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060dMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Master_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:634558-1047246Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-994227,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-20Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_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 eventMaster_Host: 192.168.6.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000039Read_Master_Log_Pos: 122238144Relay_Log_File: relay.000091Relay_Log_Pos: 807Relay_Master_Log_File: binlog.000039Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 122238144Relay_Log_Space: 122238845Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 330613Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060dMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Replica has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:634558-1047248Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1047248,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-20Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_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 eventMaster_Host: 192.168.6.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000040Read_Master_Log_Pos: 67009395Relay_Log_File: relay.000091Relay_Log_Pos: 11750613Relay_Master_Log_File: binlog.000039Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 1049Last_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 logMaster_Host: 192.168.6.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000040Read_Master_Log_Pos: 514040758Relay_Log_File: relay.000097Relay_Log_Pos: 405Relay_Master_Log_File: binlog.000040Slave_IO_Running: YesSlave_SQL_Running: NoReplicate_Do_DB: Replicate_Ignore_DB: sbtestReplicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 196Relay_Log_Space: 514041475Until_Condition: SQL_BEFORE_GTIDSUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 330613Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060dMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Master_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1052495-1287353Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1064457,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-22Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_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 eventMaster_Host: 192.168.6.13Master_User: svr_slaveMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000040Read_Master_Log_Pos: 569068103Relay_Log_File: relay.000098Relay_Log_Pos: 1881Relay_Master_Log_File: binlog.000040Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 569068103Relay_Log_Space: 569068804Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_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: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 330613Master_UUID: 86f14188-54fe-11ed-9f7a-0242c0a8060dMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Replica has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1052495-1311285Executed_Gtid_Set: 86f14188-54fe-11ed-9f7a-0242c0a8060d:1-1311285,
871fa289-54fe-11ed-9b0e-0242c0a8060e:1-22Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

在这里插入图片描述

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

这篇关于MySQL主从复制重新初始化单表或者单库的方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1100873

相关文章

Python中的魔术方法__new__详解

《Python中的魔术方法__new__详解》:本文主要介绍Python中的魔术方法__new__的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、核心意义与机制1.1 构造过程原理1.2 与 __init__ 对比二、核心功能解析2.1 核心能力2.2

Python Transformer 库安装配置及使用方法

《PythonTransformer库安装配置及使用方法》HuggingFaceTransformers是自然语言处理(NLP)领域最流行的开源库之一,支持基于Transformer架构的预训练模... 目录python 中的 Transformer 库及使用方法一、库的概述二、安装与配置三、基础使用:Pi

关于pandas的read_csv方法使用解读

《关于pandas的read_csv方法使用解读》:本文主要介绍关于pandas的read_csv方法使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录pandas的read_csv方法解读read_csv中的参数基本参数通用解析参数空值处理相关参数时间处理相关

前端下载文件时如何后端返回的文件流一些常见方法

《前端下载文件时如何后端返回的文件流一些常见方法》:本文主要介绍前端下载文件时如何后端返回的文件流一些常见方法,包括使用Blob和URL.createObjectURL创建下载链接,以及处理带有C... 目录1. 使用 Blob 和 URL.createObjectURL 创建下载链接例子:使用 Blob

MySQL 分区与分库分表策略应用小结

《MySQL分区与分库分表策略应用小结》在大数据量、复杂查询和高并发的应用场景下,单一数据库往往难以满足性能和扩展性的要求,本文将详细介绍这两种策略的基本概念、实现方法及优缺点,并通过实际案例展示如... 目录mysql 分区与分库分表策略1. 数据库水平拆分的背景2. MySQL 分区策略2.1 分区概念

MySQL高级查询之JOIN、子查询、窗口函数实际案例

《MySQL高级查询之JOIN、子查询、窗口函数实际案例》:本文主要介绍MySQL高级查询之JOIN、子查询、窗口函数实际案例的相关资料,JOIN用于多表关联查询,子查询用于数据筛选和过滤,窗口函... 目录前言1. JOIN(连接查询)1.1 内连接(INNER JOIN)1.2 左连接(LEFT JOI

MySQL 中查询 VARCHAR 类型 JSON 数据的问题记录

《MySQL中查询VARCHAR类型JSON数据的问题记录》在数据库设计中,有时我们会将JSON数据存储在VARCHAR或TEXT类型字段中,本文将详细介绍如何在MySQL中有效查询存储为V... 目录一、问题背景二、mysql jsON 函数2.1 常用 JSON 函数三、查询示例3.1 基本查询3.2

MySQL中动态生成SQL语句去掉所有字段的空格的操作方法

《MySQL中动态生成SQL语句去掉所有字段的空格的操作方法》在数据库管理过程中,我们常常会遇到需要对表中字段进行清洗和整理的情况,本文将详细介绍如何在MySQL中动态生成SQL语句来去掉所有字段的空... 目录在mysql中动态生成SQL语句去掉所有字段的空格准备工作原理分析动态生成SQL语句在MySQL

Java中使用Hutool进行AES加密解密的方法举例

《Java中使用Hutool进行AES加密解密的方法举例》AES是一种对称加密,所谓对称加密就是加密与解密使用的秘钥是一个,下面:本文主要介绍Java中使用Hutool进行AES加密解密的相关资料... 目录前言一、Hutool简介与引入1.1 Hutool简介1.2 引入Hutool二、AES加密解密基础

MySQL中FIND_IN_SET函数与INSTR函数用法解析

《MySQL中FIND_IN_SET函数与INSTR函数用法解析》:本文主要介绍MySQL中FIND_IN_SET函数与INSTR函数用法解析,本文通过实例代码给大家介绍的非常详细,感兴趣的朋友一... 目录一、功能定义与语法1、FIND_IN_SET函数2、INSTR函数二、本质区别对比三、实际场景案例分