MySQL(MariaDB)经常崩溃


9

我最近将一台运行MySQL的旧服务器迁移到了一台运行MariaDB 5.5的新VPS。我在服务器上没有运行太多的东西(仅几个PHP站点),可用内存似乎还可以,但是数据库不断崩溃-有时每隔几天,有时在几个小时内崩溃。

我在日志中收到以下错误:

131231  1:43:04 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
131231  1:43:04 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
131231  1:43:04 [ERROR] mysqld: Out of memory (Needed 72499200 bytes)
131231  1:43:04 [ERROR] mysqld: Out of memory (Needed 54362112 bytes)
131231  1:43:04 InnoDB: The InnoDB memory heap is disabled
131231  1:43:04 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131231  1:43:04 InnoDB: Compressed tables use zlib 1.2.3.4
131231  1:43:04 InnoDB: Using Linux native AIO
131231  1:43:04 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
131231  1:43:04 InnoDB: Completed initialization of buffer pool
131231  1:43:04 InnoDB: Fatal error: cannot allocate memory for the buffer pool
131231  1:43:04 [ERROR] Plugin 'InnoDB' init function returned error.
131231  1:43:04 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
131231  1:43:04 [Note] Plugin 'FEEDBACK' is disabled.
131231  1:43:04 [ERROR] Unknown/unsupported storage engine: InnoDB
131231  1:43:04 [ERROR] Aborting

131231  1:43:04 [Note] /usr/sbin/mysqld: Shutdown complete

我使用了InnoDB Heap的my.cnf设置,似乎没有帮助。这是相关的部分:

innodb_buffer_pool_size = 128M
innodb_log_buffer_size  = 8M
innodb_file_per_table   = 1
innodb_open_files       = 400
innodb_io_capacity      = 400
innodb_flush_method     = O_DIRECT

我似乎有“大量”的可用RAM,并且还有一些可用的交换空间:

root@phoenix:~# free -m
             total       used       free     shared    buffers     cached
Mem:           994        923         71          0         19        417
-/+ buffers/cache:        486        508
Swap:         1023        131        892

我该如何解决/解决此问题?我已经在interwebz上寻找了线索,但是没有任何帮助。


1
内存在崩溃之前看起来像什么?在[ERROR] mysqld: Out of memory肯定看起来像一个强烈的暗示。您是否检查系统日志以查看内核(OOM)是否决定终止mysql?
Zoredache 2014年

您应该记录崩溃之前和之后使用的文件句柄和使用的内存(甚至可能是top每个时间间隔都转储命令),以了解可能导致崩溃的原因。像mysql(mariadb)这样的服务器上是否还运行其他服务?
Ashwin kumar

1
在DBA上有一个非常好的答案似乎很有帮助:dba.stackexchange.com/questions/1927/…–
Matt Hamann

尝试performance_schema = off吗?

Answers:


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.