无法启动MySQL社区服务器 -> InnoDB强制恢复错误 -> InnoDB mmamp错误



我正在使用Ubuntu 18.04和最新的MySQL运行一个AWS Lightsail实例。几天后,MySQL服务会随机停止,然后强迫我手动重新启动,然后在24-48小时内一切恢复正常,直到我再次停止。

终端在运行sudo service mysql status:时回显此错误

● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-04-26 17:54:44 UTC; 10h ago
Process: 30117 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 30095 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 14182 (code=killed, signal=KILL)
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: Failed to start MySQL Community Server.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: mysql.service: Scheduled restart job, restart counter is at 8.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: Stopped MySQL Community Server.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: mysql.service: Start request repeated too quickly.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 26 17:54:44 ip-172-26-4-241 systemd[1]: Failed to start MySQL Community Server.

在浏览了/var/log/mysql/error.log文件后,我发现了几十行这样的行:

2020-04-26T10:10:46.710146Z 2 [ERROR] InnoDB: innodb_force_recovery is on. We do not allow database modifications by the user. Shut down mysqld and edit my.cnf to$

由于错误消息在处被截断,正好是错误的位置,我对其他Warning消息进行了进一步的挖掘,发现了以下消息:

2020-04-26T17:54:44.312663Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2020-04-26T17:54:44.312671Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2020-04-26T17:54:44.312675Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-04-26T17:54:44.312680Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-04-26T17:54:44.312684Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-04-26T17:54:44.312688Z 0 [ERROR] Failed to initialize builtin plugins.
2020-04-26T17:54:44.312691Z 0 [ERROR] Aborting

我绝不是MySQL专家,但我将mmamp错误解释为系统空间不足,这有点奇怪,因为该实例使用了大约10%的空间,并且同时最多有2个用户(因此CPU使用很少或根本没有(。我运行了一个单站点Wordpress安装(只是为了转移用户(和phpmyadmin以及一些小的测试脚本。

感谢您的帮助,谢谢。

最有可能的原因是您的配置被破坏,导致mysqld试图分配服务器拥有的更多内存。

最新更新