评论

收藏

[MySQL] 找回“消失”的InnoDB引擎

数据库 数据库 发布于:2021-07-04 11:11 | 阅读数:540 | 评论:0

  夜里重做主从复制,顺便调整了下从库的my.cnf。早上想起从库忘了重启,打完命令接着开启slave,居然报错
  Last_SQL_Errno: 1286
Last_SQL_Error: Error executing row event: 'Unknown storage engine 'InnoDB''

  奇怪,怎么会报错不知道存储引擎InnoDB。查看下引擎:
mysql> show engines;
+--------------------+---------+-----------------------------------------------------------+--------------+------+------------+
| Engine       | Support | Comment                           | Transactions | XA   | Savepoints |
+--------------------+---------+-----------------------------------------------------------+--------------+------+------------+
| MEMORY       | YES   | Hash based, stored in memory, useful for temporary tables | NO       | NO   | NO     |
| PERFORMANCE_SCHEMA | YES   | Performance Schema                    | NO       | NO   | NO     |
| MyISAM       | DEFAULT | MyISAM storage engine                   | NO       | NO   | NO     |
| CSV        | YES   | CSV storage engine                    | NO       | NO   | NO     |
| MRG_MYISAM     | YES   | Collection of identical MyISAM tables           | NO       | NO   | NO     |
+--------------------+---------+-----------------------------------------------------------+--------------+------+------------+
5 rows in set (0.01 sec)
  没了,InnoDB真的没了。我的心一下慌了,从来没听说过过引擎会自己消失的啊!再看看错误日志怎么说
130829  8:42:30 [Note] Slave I/O thread: connected to master 'slave@192.168.0.153:3306',replication started in log 'mysql-bin.000023' at position 232546566
130829  8:42:30 [ERROR] Slave SQL: Error executing row event: 'Unknown storage engine 'InnoDB'', Error_code: 1286
130829  8:42:30 [Warning] Slave: Unknown storage engine 'InnoDB' Error_code: 1286
130829  8:42:30 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000023' position 225856952
  看来InnoDB确实消失了。
  遇到问题要先靠自己,这样才会提高自己。想想事件的过程:InnoDB消失了。为什么会消失?为什么是今天消失?我都有做过什么?好好想想。。。。
  配置文件,没错,我夜里调整了my.cnf,然后早上重启mysql,然后InnoDB不见了。OK,原因找到了。赶紧将调整前后的配置文件对比,看看咱都改了哪些啊,发现了最可疑的一个配置项:
  innodb_log_files_in_group = 3
  改回调整前的值2,重启mysql,开启slave,复制正常了,查看引擎,InnoDB也回来了!万幸啊。InnoDB的消失其实是因为修改配置导致mysql生成新的ib_logfile日志与旧的ib_logfile日志混乱引起的。整理下修改此配置项的操作步骤
service mysqld stop
cd到数据目录下
mv ib_logfile* 到其他目录下
修改innodb_log_files_in_group
service mysqld start
  

  

  


  
关注下面的标签,发现更多相似文章