sql_slave_skip_counter跳过太多的反应
一套主从环境,
在主上操作的ddl,dml操作,不能同步到从库上,看主从状态却也是正常的:
主:
mysql> show master status ;
+------------------+----------+--------------+------------------+-------------------+
| File | Position
| Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000147 | 1207 |
| | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
从:
mysql> show slave status\G
*************************** 1. row
***************************
Slave_IO_State: Waiting for
master to send event
Master_Host: 10.4.19.47
Master_User: sla
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000147
Read_Master_Log_Pos:
1207
Relay_Log_File:
mysql-relay.000033
Relay_Log_Pos: 1366
Relay_Master_Log_File: mysql-bin.000147
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: 972
Exec_Master_Log_Pos:1207
Relay_Log_Space: 1574
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: 168039296
Master_UUID: 3792e897-29cd-11e5-9e1b-525400e7dba2
Master_Info_File: /data/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay:
NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for
the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
主:
use test;
create table t10 (id int);
insert into t10 values (10),(20),(30);
mysql> show master status ;
+------------------+----------+--------------+------------------+-------------------+
| File | Position
| Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000147 | 1604 |
| | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
从:
mysql> show slave status \G
*************************** 1. row
***************************
Slave_IO_State: Waiting for
master to send event
Master_Host: 10.4.19.47
Master_User: sla
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000147
Read_Master_Log_Pos:
1604
Relay_Log_File:
mysql-relay.000034
Relay_Log_Pos: 676
Relay_Master_Log_File: mysql-bin.000147
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: 967
Exec_Master_Log_Pos: 1604
Relay_Log_Space: 2087
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: 168039296
Master_UUID: 3792e897-29cd-11e5-9e1b-525400e7dba2
Master_Info_File: /data/data/master.info
SQL_Delay: 0
SQL_Remaining_Delay:
NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for
the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
mysql> show create table test.t10;
ERROR 1146 (42S02): Table 'test.t10' doesn't exist
mysql> show relaylog events in 'mysql-relay.000034';
+--------------------+-----+-------------+-----------+-------------+---------------------------------------------------+
| Log_name | Pos | Event_type
| Server_id | End_log_pos | Info
|
+--------------------+-----+-------------+-----------+-------------+---------------------------------------------------+
| mysql-relay.000034 | 372 | Query | 168039296 |
1395 | use `test`; create table t10 (id int)
|
| mysql-relay.000034 | 467 | Query | 168039296 |
1470 | BEGIN |
| mysql-relay.000034 | 542 | Query | 168039296 |
1577 | use `test`; insert into t10 values
(10),(20),(30) |
| mysql-relay.000034 | 649 | Xid |
168039296 | 1604 | COMMIT
|
+--------------------+-----+-------------+-----------+-------------+---------------------------------------------------+
日志还是读过来的。
想想有点晕,怎么会没有同步过来呢。
想起来,原来这个库执行过set global sql_salve_skip_counter=1000;
mysql> show variables like '%skip%';
+------------------------+-------+
| Variable_name | Value
|
+------------------------+-------+
| skip_external_locking | ON |
| skip_name_resolve | ON |
| skip_networking | OFF |
| skip_show_database | OFF
|
| slave_skip_errors | OFF |
| sql_slave_skip_counter | 967 |
+------------------------+-------+
6 rows in set (0.00 sec)
其实这个在 show slave status中的Skip_Counter也是显示出来的。
转载请注明源出处
QQ 273002188 欢迎一起学习
QQ 群
236941212