Mysqld: Incorrect Key File For Table ‘./mysql/ndb_binlog_index.myi’; 尝试恢复

适用于:

MySQL集群版本6.3及以上

本文信息适用于所有平台。

 

症状

在特定情况下,系统表ndb_binlog_index可能被损坏。

 

当尝试执行以下查询时,这个损坏最常见的症状是ERROR 1194:

 

 

query:
mysql> SELECT * from ndb_binlog_index;
ERROR 1194 (HY000): Table 'ndb_binlog_ index' is marked as crashed and should be repaired

 

表损坏也能从MySQL错误日志中被证实:

 

Faile d to flush master info file
Slave I/O thread exiting, read u p to log 'log‐bin.NNNNNN', position MMMMMMMMM
Error reading relay log event: slave SQL thread was killed
Error writing file 'path‐to‐binlog/log‐bin' (errno: 30)
mysqld: Incorrect key file for table './mysql/ndb_binlo g_index.MYI'; try to repair it
NDB Binlog: Writing row (A,B,C) to ndb_binlog_index: N

 

 

原因

磁盘故障是这种情况最可能的原因。

 

实际上,损坏可能就在磁盘故障后发生,示例如下:

 

 

kernel: sd 0:0:0:0: SCSI error: return code = 0x06000000
kernel: end_request: I/O error, dev sda, sector 112313
kernel: Buffer I/O error on device sda1, logical block 14039
kernel: lost page write due to I/O error on sda1
kernel: Aborting journal on device sda1.
kernel: journal commit I/O error
kernel: journal commit I/O error
kernel: journal commit I/O error
kernel: journal commit I/O error
kernel: ext3_abort called.
kernel: EXT3‐fs error (dev ice sda1): ext3_journal_start_sb: Detected aborted journal
kernel: Remounting filesystem read‐only
logrotd: Rotating log /var/log/ldapfe
mysqld: Failed to flush master info f ile
mysqld: Slave I/O thread exiting, read u p to log 'log‐bin.000007', position 59561189
mysqld: Error reading relay log event: slave SQL thread was killed

 

解决方案

建议的方法是使用以下命令:

 

REPAIR TABLE ndb_binlog_index table;

 

参考

https://dev.mysql.com/doc/refman/5.6/en/repairtable.html

 

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *