mysql child process_mysql致命错误:无法为缓冲区p分配内存

TLDR

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

帮不上忙?如果这不是你的问题,更适合继续研究的问题是:

背景

我在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

注意:如果错误发生在cron轮换日志之前,则可能需要对存档日志进行压缩和搜索。

解决方案

在我的例子中,根本的问题是我忽略了配置交换文件。

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

total used free shared buffers cached

Mem: 604340 587364 16976 0 29260 72280

-/+ buffers/cache: 485824 118516

Swap: 0 0 0

在上面的示例中,Swap:0表示没有swapfile。

关于设置一个的教程:

注意,越大未必越好!来自Ubuntu guide:The "diminishing returns" means that if you need more swap space than twice your RAM size, you'd better add more RAM as Hard Disk Drive (HDD) access is about 10³ slower then RAM access, so something that would take 1 second, suddenly takes more then 15 minutes! And still more then a minute on a fast Solid State Drive (SSD)...

关于这里的其他答案

The InnoDB memory heap is disabledThis isn’t really an error, just an indication that InnoDB is using the system’s internal memory allocator instead of its own. The default is yes/1, and is acceptable for production.

According to the docs, this command is deprecated, and will be removed in MySQL versions above 5.6 (and I assume MariaDB):

[Note] Plugin 'FEDERATED' is disabled.The message about FEDERATED disabled is not an error. It just meant that the FEDERATED engine its not ON for your mysql server. It's not used by default. If you don't need it, don't care about this message.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值