MySQL主从同步延迟
dba@(none) 02:48:05>show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.15.11
Master_User: dbsync
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.002351
Read_Master_Log_Pos: 276113513
Relay_Log_File: relaylog.007789
Relay_Log_Pos: 178335825
Relay_Master_Log_File: mysql-bin.002339
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: 178335662
Relay_Log_Space: 13178574309
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
重启从库,主从同步正常。
1:从库sql_thread单线程工作
show slave status\G;
在主库执行:mysqlbinlong --base64-output=decode-rows -v --start-position=exec_master_log_pos relay_master_log_file
基于GTID的主从复制:
主库的UUID值
mysql> select @@server_uuid;
+--------------------------------------+
| @@server_uuid |
+--------------------------------------+
| ffc53fd1-a4f6-11e8-84bb-525400492e59 |
+--------------------------------------+
1 row in set (0.00 sec)
cat /data/mysql_3306/data/auto.cnf
[auto]
server-uuid=ffc53fd1-a4f6-11e8-84bb-525400492e59
主库查询Gtid_Set:
从库查询Gtid_Set:
为什么在从库查询的GTID_SET多出几条?
正常情况下,从库的GTID_SET:UUID是与主库的GTID_SET:UUID值对应,多出的几条是因为该从库做过迁移 ,之前是另一个主库的从库
做迁移的时候,没有做reset slave all;