现在的位置: 首页 > 综合 > 正文

mysql 同步线程出现ERROR 2006 (HY000): MySQL server has gone away

2013年04月18日 ⁄ 综合 ⁄ 共 1793字 ⁄ 字号 评论关闭

今天线上一个备库的同步线程出现ERROR 2006 (HY000): MySQL server has gone away,感觉很奇葩,如下:

mysql> show slave status\G
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/home/mysql/mysql/tmp/mysql.sock' (2)
ERROR:
Can't connect to the server

果断查看错误日志:

InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
130602 12:53:40 mysqld_safe Number of processes running now: 0
130602 12:53:40 mysqld_safe mysqld restarted

说明数据页已经损坏了,怎么办?

抱着侥幸的心里加了--innodb_force_recovery=4 参数启动,重启实例,出现如下错误

Error 'Got error -1 from storage engine' on query. Default database: ‘xxx. Query: 'insert into xxxxxx (xx, xx, xxt) values ('efe99421b8038e79843acd0b650afb65', '鏃呮父', '{\"d\":{\"1369977481439\":[{\"n\":\"886101552531604045\",\"c\":\"1543429242 2847814627\"},{\"n\":\"9783085646656052076\",\"c\":\"65157479
2148290874\"},{\"n\":\"8842770608579691284\",\"c\":\"2828403933 962579475\"},{\"n\":\"4532336517264170948\",\"c\":\"2775100323 1262656757\"},{\"n\":\"10283011393799334833\",\"c\":\"832035076 2124070745\"},{\"n\":\"1636910875901144556\",\"c\":\"2441385694 4180750260\"},{\"n\":\"1454801548211122109\",\"c\":\"3872414415
1758090072\"},{\"n\":\"9617252920492977348\",\"c\":\"931080628 4009789701\"},{\"n\":\"10532308482238392940\",\"c\":\"2626421970 2517210497\"},{\"n\":\"3697079241674906690\",\"c\":\"878991478 2838000654\"},{\"n\":\"8877643288045826882\",\"c\":\"3769206655 4119371468\"},{\"n\":\"8720596808003303846\",\"c\":\"91351183
1451699941\"},{\"n\":\"3905702330576

数据物理页损坏,已经无法修复,重做数据,将数问题表据导出,然后倒入数据库;

然后重新同步,问题消失!

抱歉!评论已关闭.