mysql致命错误:无法为缓冲池分配内存

我有来自MySQL的错误日志,知道吗?网站工作了一段时间,然后几个小时后我完全关闭了MySQL。

140919 10:48:27 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.

140919 10:48:27 [Note] Plugin 'FEDERATED' is disabled.

140919 10:48:27 InnoDB: The InnoDB memory heap is disabled

140919 10:48:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins

140919 10:48:27 InnoDB: Compressed tables use zlib 1.2.3.4

140919 10:48:28 InnoDB: Initializing buffer pool, size = 128.0M

InnoDB: mmap(137363456 bytes) failed; errno 12

140919 10:48:28 InnoDB: Completed initialization of buffer pool

140919 10:48:28 InnoDB: Fatal error: cannot allocate memory for the buffer pool

140919 10:48:28 [ERROR] Plugin 'InnoDB' init function returned error.

140919 10:48:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

140919 10:48:28 [ERROR] Unknown/unsupported storage engine: InnoDB

140919 10:48:28 [ERROR] Aborting

140919 10:48:28 [Note] /usr/sbin/mysqld: Shutdown complete

140919 10:48:28 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.

140919 10:48:28 [Note] Plugin 'FEDERATED' is disabled.

140919 10:48:28 InnoDB: The InnoDB memory heap is disabled

140919 10:48:28 InnoDB: Mutexes and rw_locks use GCC atomic builtins

140919 10:48:28 InnoDB: Compressed tables use zlib 1.2.3.4

140919 10:48:28 InnoDB: Initializing buffer pool, size = 128.0M

InnoDB: mmap(137363456 bytes) failed; errno 12

140919 10:48:28 InnoDB: Completed initialization of buffer pool

140919 10:48:28 InnoDB: Fatal error: cannot allocate memory for the buffer pool

140919 10:48:28 [ERROR] Plugin 'InnoDB' init function returned error.

140919 10:48:28 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

140919 10:48:28 [ERROR] Unknown/unsupported storage engine: InnoDB

140919 10:48:28 [ERROR] Aborting

140919 10:48:28 [Note] /usr/sbin/mysqld: Shutdown complete

回答:

回答:

Mysql由于内存不足而无法重新启动,请检查是否配置了适当的交换文件。

没帮助吗 如果这不是您的问题,那么继续研究的更多合格问题是:

  • mysqld服务每天在ec2服务器上停止一次
  • https://askubuntu.com/questions/422037/optimising-mysql-settings-mysqld-running-out-of-memory

回答:

我在EC2上建立的第一个系统上确实遇到了这个问题,该系统的特点是那里托管的wordpress网站有时会因“建立数据库连接错误”而崩溃。

日志显示与OP发布的错误相同的错误。我对错误的了解(已删除时间戳)是:

  • 内存不足错误: InnoDB: Fatal error: cannot allocate memory for the buffer pool
  • 没有足够的内存,InnoDB无法启动 [ERROR] Plugin 'InnoDB' init function returned error. [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. [ERROR] Unknown/unsupported storage engine: InnoDB [ERROR] Aborting
  • mysqld正在关闭,在这种情况下,这实际上意味着无法重新启动! [Note] /usr/sbin/mysqld: Shutdown complete

检查/var/log/syslog并搜索 mysql 产量:

Out of memory: Kill process 15452 (mysqld) score 93 or sacrifice child

Killed process 15452 (mysqld) total-vm:888672kB, anon-rss:56252kB, file-rss:0kB

init: mysql main process (15452) killed by KILL signal

init: mysql main process ended, respawning

type=1400 audit(1443812767.391:30): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=21984 comm="apparmor_parser"

init: mysql main process (21996) terminated with status 1

init: mysql main process ended, respawning

init: mysql post-start process (21997) terminated with status 1

<repeated>

注意:如果错误是在cron旋转日志之前发生的,则可能需要压缩并搜索存档的日志。

回答:

就我而言,根本问题是我忽略了配置交换文件。

您可以通过运行查看是否配置了一个free -m

total used free shared buffers cached Mem: 604340 587364 16976 0 29260 72280

-/+ buffers/cache: 485824 118516 Swap: 0 0 0

在上面的示例中,交换:0表示没有交换文件。

有关设置的教程:

  • https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04
  • https://help.ubuntu.com/community/SwapFaq

从Ubuntu指南:

“收益递减”表示, 如果您需要更多的交换空间而不是RAM大小的两倍

,则最好添加更多的RAM,因为硬盘驱动器(HDD)的访问速度比RAM的访问速度慢约10³,因此大约 需要1秒钟,突然花了15分钟以上

!快速固态硬盘(SSD)上还有一分钟多的时间…


回答:

The InnoDB memory heap is disabled

这实际上不是错误,只是表明InnoDB正在使用系统的内部内存分配器而不是其自身的内存。默认值为yes / 1,并且可以接受生产。

根据文档,此命令已弃用,并将在5.6以上的MySQL版本中删除(并且我假设为MariaDB):

http://dev.mysql.com/doc/refman/5.6/en/innodb-performance-

use_sys_malloc.html

感谢:Ruben Schade评论

[Note] Plugin 'FEDERATED' is disabled.

关于禁用FEDERATED的消息不是错误。这只是意味着FEDERATED引擎在您的mysql服务器上未开启。默认情况下不使用。如果您不需要它,则无需关心此消息。

参见:https :

//stackoverflow.com/a/16470822/2586761

以上是 mysql致命错误:无法为缓冲池分配内存 的全部内容, 来源链接: utcz.com/qa/434840.html

回到顶部