虽然不是什么开源社区的贡献者,但是微魔始终紧跟时代步伐,义无反顾的加入了MariaDB的阵营(就是跟风呗)。最近在使用中经常出现“数据库连接错误”,实际上是MariaDB莫名其妙的Out of memory问题(详细的错误日志见下文)。在国外某知名搜(Go)索(og)引(le)擎上搜索了一下解决方案,发现解决起来倒也简单,只需要在my.cnf配置文件中的[mysqld]段内,加入performance_schema = off即可。解决的依据主要是暂停掉performance_schema这个吃内存的东西,这个解决方法对小内存VPS格外有效,但是微魔这1G内存上也会出现这个问题,也是醉了,不过确实在安装环境之后,微魔才从512M内存升级到1G的,不知道跟这个有没有关系,也希望看到本文的大佬或者是技术达人能不吝赐教。
MariaDB错误日记(/var/log/mariadb/mariadb.log)
170331 18:27:11 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137756672 bytes) failed; errno 12 170331 18:27:11 InnoDB: Completed initialization of buffer pool 170331 18:27:11 InnoDB: Fatal error: cannot allocate memory for the buffer pool 170331 18:27:11 [ERROR] Plugin 'InnoDB' init function returned error. 170331 18:27:11 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 170331 18:27:11 [ERROR] mysqld: Out of memory (Needed 128917504 bytes) 170331 18:27:11 [ERROR] mysqld: Out of memory (Needed 96681984 bytes) 170331 18:27:11 [ERROR] mysqld: Out of memory (Needed 72499200 bytes) 170331 18:27:13 [Note] Plugin 'FEEDBACK' is disabled. 170331 18:27:13 [ERROR] Unknown/unsupported storage engine: InnoDB 170331 18:27:13 [ERROR] Aborting