服務(wù)連接不到MySQL,MySQL日志報(bào)錯(cuò),數(shù)據(jù)庫(kù)損壞!
2018-06-11T12:50:24.617098Z0[ERROR] InnoDB: Page [page id: space=42, page number=3]logsequence number14532708is in the future! Current systemlogsequence number12151645.
2018-06-11T12:50:24.617116Z0[ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDBlogfiles. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
MySQL報(bào)錯(cuò),數(shù)據(jù)庫(kù)損壞
解決方法1:
1.停掉服務(wù)?
2.將數(shù)據(jù)中的ib_logfile* ib_buffer_pool刪掉 rm -rf ib_logfile* ib_buffer_pool?
3.重新構(gòu)建服務(wù)?
4.不行的話,就要進(jìn)入該服務(wù)的MySQL鏡像中 kill掉MySQL的進(jìn)程,在重啟服務(wù)
還有就是根據(jù)提示到MySQL頁(yè)面 innodb_force_recovery = 1
innodb_force_recovery的參數(shù)詳解:
1是跳過(guò)損壞的索引,服務(wù)正常運(yùn)行?
2是防止主線程和任何清除線程運(yùn)行?
3是崩潰恢復(fù)后,不允許事務(wù)?
4是可能會(huì)永久損壞數(shù)據(jù)文件,準(zhǔn)備重新構(gòu)建二級(jí)索引,innodb為只讀模式?
5是不會(huì)查看撤銷(xiāo)日志,即時(shí)事務(wù)未完成,也被視為已經(jīng)提交,可能永久損壞數(shù)據(jù)文件。innodb為只讀?
6是 不恢復(fù)相關(guān)的日志,直接重新創(chuàng)建日志文件,可能永久損壞數(shù)據(jù)。innodb為只讀
解決方法二
這個(gè)報(bào)錯(cuò)是指innodb的索引頁(yè)壞了,數(shù)據(jù)應(yīng)該是沒(méi)有問(wèn)題 首先將所有的庫(kù)數(shù)據(jù)備份
mysqldump-u root -p --all-databases >all-databases.sql
停掉服務(wù)的pod
清空GlusterFS服務(wù)器上的對(duì)應(yīng)服務(wù)的數(shù)據(jù)備份
重新構(gòu)建該服務(wù)
docker cp 將備份文件放到服務(wù)的MySQL容器中
查看該服務(wù)在哪里啟動(dòng)后進(jìn)入MySQL
查看庫(kù)
showdatabases;
進(jìn)入庫(kù) use + 庫(kù)名
導(dǎo)入sql語(yǔ)句
sourceall-databases.sql