簡體   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