MySQL(MariaDB)频繁崩溃

MySQL(MariaDB)频繁崩溃

我最近将运行 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

我该如何解决/排除此问题?我在网上搜索了各种线索,但毫无帮助。

答案1

希望对你有帮助。

尝试

performance_schema = off

[mysqld]您的配置部分中。

https://mariadb.com/resources/blog/starting-mysql-on-low-memory-virtual-machines/

相关内容