由于主机Master磁盘写满导致主从无法同步,为Master增加磁盘并恢复服务后,导致从机如下错误:
mysql> SHOW SLAVE STATUS\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.1.60
Master_User: syncuser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000016
Read_Master_Log_Pos: 1011285945
Relay_Log_File: syncuser022-relay-bin.000003
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000001
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:
Last_Errno: 145
Last_Error: Error 'Table './mysql/proc' is marked as crashed and should be repaired' on query. Default database: 'imusers'. Query: 'DROP SCHEMA IF EXISTS `imusers`'
Skip_Counter: 0
Exec_Master_Log_Pos: 107
Relay_Log_Space: 17117426719
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the last event was read from './mysql-bin.000016' at 1011285945, the last byte read was read from './mysql-bin.000016' at 1011286016.'
Last_SQL_Errno: 145
Last_SQL_Error: Error 'Table './mysql/proc' is marked as crashed and should be repaired' on query. Default database: 'imusers'. Query: 'DROP SCHEMA IF EXISTS `imusers`'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 60
1 row in set (0.00 sec)
ERROR:
No query specified
处理方法:
在从机上解决异常:'Table './mysql/proc' is marked as crashed and should be repaired' on query.错误。
或
ERROR 145 (HY000): Table './mysql/proc' is marked as crashed and should be repaired
解决方法
mysql> repair table mysql.proc;
+------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+------------+--------+----------+----------+
| mysql.proc | repair | status | OK |
+------------+--------+----------+----------+
CHANGE MASTER TO MASTER_HOST='192.168.1.60',MASTER_USER='syncuser', MASTER_PASSWORD='st@rhu6kb00k',MASTER_LOG_FILE='binlog.000023',MASTER_LOG_POS=189;
slave start;
slave stop;
reset slave;
slave start;
重新与主机同步即可。
mysql> SHOW SLAVE STATUS\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.1.60
Master_User: syncuser
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000016
Read_Master_Log_Pos: 1011285945
Relay_Log_File: syncuser022-relay-bin.000003
Relay_Log_Pos: 253
Relay_Master_Log_File: mysql-bin.000001
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:
Last_Errno: 145
Last_Error: Error 'Table './mysql/proc' is marked as crashed and should be repaired' on query. Default database: 'imusers'. Query: 'DROP SCHEMA IF EXISTS `imusers`'
Skip_Counter: 0
Exec_Master_Log_Pos: 107
Relay_Log_Space: 17117426719
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: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the last event was read from './mysql-bin.000016' at 1011285945, the last byte read was read from './mysql-bin.000016' at 1011286016.'
Last_SQL_Errno: 145
Last_SQL_Error: Error 'Table './mysql/proc' is marked as crashed and should be repaired' on query. Default database: 'imusers'. Query: 'DROP SCHEMA IF EXISTS `imusers`'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 60
1 row in set (0.00 sec)
ERROR:
No query specified
处理方法:
在从机上解决异常:'Table './mysql/proc' is marked as crashed and should be repaired' on query.错误。
或
ERROR 145 (HY000): Table './mysql/proc' is marked as crashed and should be repaired
解决方法
mysql> repair table mysql.proc;
+------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+------------+--------+----------+----------+
| mysql.proc | repair | status | OK |
+------------+--------+----------+----------+
然后再在从机上执行:
CHANGE MASTER TO MASTER_HOST='192.168.1.60',MASTER_USER='syncuser', MASTER_PASSWORD='st@rhu6kb00k',MASTER_LOG_FILE='binlog.000023',MASTER_LOG_POS=189;
slave start;
slave stop;
reset slave;
slave start;
SHOW SLAVE STATUS\G;
重新与主机同步即可。