繁体   English   中英

AWS MYSQL(mysqli_real_connect():( HY000 / 2002)):无法为缓冲池分配内存

[英]AWS MYSQL (mysqli_real_connect(): (HY000/2002)) : cannot allocate memory for the buffer pool

我在AWS中有一个t2.small实例已经运行了10个月的大部分时间而没有重新启动EC2实例/ apache server / mysqld服务器突然,几分钟之前,它无法连接到数据库。

我无法访问任何连接到数据库的页面并尝试登录phpmyadmin返回错误mysqli_real_connect(): (HY000/2002): No such file or directory

因此,在恐慌时,我做了以下事情:

  1. 尝试使用sudo service mysqld restart重新启动mysql服务器,但它只是一直STOPPED使用STOPPED
  2. 重启EC2实例
  3. 它存在(现在直到它再次崩溃)

由于它已经崩溃,我想知道为什么它崩溃了,以及如何防止它再次崩溃。

我挖到mysqld.log并找到以下信息:

Version: '5.6.39'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
2019-06-17 14:08:19 15623 [Warning] Buffered warning: Performance schema disabled (reason: init fa
iled).

2019-06-17 14:08:19 15623 [Note] Plugin 'FEDERATED' is disabled.
2019-06-17 14:08:19 15623 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-06-17 14:08:19 15623 [Note] InnoDB: The InnoDB memory heap is disabled
2019-06-17 14:08:19 15623 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-06-17 14:08:19 15623 [Note] InnoDB: Memory barrier is not used
2019-06-17 14:08:19 15623 [Note] InnoDB: Compressed tables use zlib 1.2.8       
2019-06-17 14:08:19 15623 [Note] InnoDB: Using Linux native AIO                 
2019-06-17 14:08:19 15623 [Note] InnoDB: Using CPU crc32 instructions           
2019-06-17 14:08:19 15623 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12                                  
2019-06-17 14:08:19 15623 [ERROR] InnoDB: Cannot allocate memory for the buffer pool           
2019-06-17 14:08:19 15623 [ERROR] Plugin 'InnoDB' init function returned error. 
2019-06-17 14:08:19 15623 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.     
2019-06-17 14:08:19 15623 [ERROR] Unknown/unsupported storage engine: InnoDB    
2019-06-17 14:08:19 15623 [ERROR] Aborting 
...
...(shutdown a bunch of plugins)
...
2019-06-17 14:08:19 15623 [Note] /usr/libexec/mysql56/mysqld: Shutdown complete

我四处搜索,发现Inconsistent InnoDB Buffer Pool Size https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.KnownIssuesAndLimitations.html

具体来说,它通过以下操作详细说明了缓冲池大小不一致的解决方案

innodb_buffer_pool_chunk_size = 536870912
innodb_buffer_pool_instances = 4
innodb_buffer_pool_size = (536870912 * 4) * 8 = 17179869184

问题:

  1. 有没有人遇到过这个? 你是怎么解决它的?
  2. 实际发生在服务器上的是什么? 我实际上真的为mysqld耗尽了内存,因为日志说不能为缓冲池分配内存吗? (我总是这样top不时检查并总是有它至少有一半免费)。
  3. 来自AWS的上述示例在哪里获得了数字536870912 我在哪里放线? (/etc/my.cnf中)?

感谢您阅读以及任何意见或建议。

1)我encoutered同样的问题,得到它由以下解决

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM