在直播APP开发过程中经常会遇到一些数据方面的问题,而数据库的使用对于直播业务来说也是非常重要的,所以本文就来简单分享下解决直播APP开发中的InnoDB:mmap(xxx bytes)failed;errno 12。
问题描述
mysql正常使用阶段,重启报错如下
ERROR! MySQL server PID file could not be found! [FAILED]
Starting MySQL. ERROR! The server quit without updating PID file (/data/mysql/data/AY1709233234.pid).[FAILED]
解决方案
1.查看mysql的错误日志报错如下
2019-04-27T06:38:42.591784Z 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
2019-04-27T06:38:42.660677Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2019-04-27T06:38:42.676335Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-04-27T06:38:42.676374Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-04-27T06:38:42.676388Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-04-27T06:38:42.676394Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-04-27T06:38:42.676402Z 0 [ERROR] Failed to initialize builtin plugins.
2019-04-27T06:38:42.676407Z 0 [ERROR] Aborting
其中,核心的错误为
[Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 8, chunk size = 128M
[ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2.修改my.cnf的innodb_buffer_pool_size值为128MB。
3.重启mysql,解决之。
解决思路
1.出了问题先看报错信息,包括但不限于直观的反馈和报错日志的反馈。
2.根据报错信息的提示,按照经验处理。
3.搜索网上关于报错信息和报错日志的方案。
以上就是在直播APP开发过程中解决InnoDB:mmap(xxx bytes)failed;errno 12的一系列流程,包括问题描述、解决方案、解决思路,如果不及时处理好很有可能就会影响到APP的正常运营。所以,在开发过程中建议大家多加注意,尽量避免出现这种问题。
声明:本文由作者原创,转载请注明出处及原文链接。