我在 AWS 中有一个 t2.small 实例,该实例已经运行了十个月之久,而无需重启EC2实例/ apache服务器/ mysqld服务器,突然之间,到几分钟前,它无法连接到数据库。
我无法访问连接到数据库的任何页面,尝试登录phpmyadmin会返回错误mysqli_real_connect(): (HY000/2002): No such file or directory
所以在恐慌时,我做了以下事情:
sudo service mysqld restart
重新启动mysql服务器,但它一直在提出STOPPED
既然它崩溃了,我想知道为什么它崩溃了,以及如何防止它再次崩溃。
我钻入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
我四处搜索,发现 InnoDB缓冲池大小不一致 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
问题:
top
进行检查,并且总是至少有一半是免费的。)536870912
?而我在哪里? (/etc/my.cnf)?感谢您阅读以及任何意见或建议。