国庆的假期就要过去了..事情也来了.今天突然接到报警短信,数据库出问题了...囧啊.....
简单的说一下:这套MySQL版本是5.6复制采用GTID(话说我还是第一次在此模式下TroubleShooting),好吧.先看一下现象
Slave:
*************************** 1. row ***************************
Slave_IO_State:
.......
.......
.......
Master_Log_File: mysql-bin.000014
Read_Master_Log_Pos: 26331976
Relay_Log_File: mysql-relay-bin-index.000026
Relay_Log_Pos: 3654
Relay_Master_Log_File: mysql-bin.000014
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB: XXXXX,XXXXX,XXXXX
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
.......
.......
.......
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1146
Last_IO_Error: Error executing row event: 'Table 'XXXXXXX' doesn't exist'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
Master_UUID: 2b11818a-1e3c-11e4-8d59-080027b71ca2
Master_Info_File: mysql.slave_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: 141007 16:32:09
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 2b11818a-1e3c-11e4-8d59-080027b71ca2:85-106
Executed_Gtid_Set: 18fdd0dd-2f69-11e4-bd58-080027db9636:1,
2b11818a-1e3c-11e4-8d59-080027b71ca2:85-105
Auto_Position: 1
又是讨厌的1146啊...先说说思路吧..其实基于GTID跟普通的MySQL复制处理起来还是大同小异的..一般出现1146不怕只是显示表不存在而已简单的方式就是看哪个表没有建哪个就可以了.要是出现1236有可能就是出现日志断点了.造成此错误也有其它原因.因为本身Auto_Position:1在CHANGE MASTER TO的时候不用特别指定POS和LOG_FILE的,GTID会自动选择事物点开始复制,针对此情况我们有两种方式解决
1、设置Auto_Position=0
2、手动设置LOG_FILE && POS
另外一种方式:
手动修改 GTID_NEXT 值
那么我们的1146错误可以这样解决
1、停同步进程
2、RESET MASTER
3、重新指定LOG_FILE && POS
4、SET @@GLOBAL.GTID_NEXT = '2b11818a-1e3c-11e4-8d59-080027b71ca2:85-106'
再看看Slave的状态:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
......
......
Master_Log_File: mysql-bin.000014
Read_Master_Log_Pos: 26331976
Relay_Log_File: mysql-relay-bin-index.000030
Relay_Log_Pos: 354
Relay_Master_Log_File: mysql-bin.000014
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
.......
.......
.......
Replicate_Ignore_Server_Ids:
Master_Server_Id: 2
Master_UUID: 2b11818a-1e3c-11e4-8d59-080027b71ca2
Master_Info_File: mysql.slave_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: 2b11818a-1e3c-11e4-8d59-080027b71ca2:85-106
Executed_Gtid_Set: 2b11818a-1e3c-11e4-8d59-080027b71ca2:85-106
Auto_Position: 0
这样复制又恢复正常了...^_^
阅读(2107) | 评论(0) | 转发(0) |