mysql55自发故障

Vla*_*nea 1 mysql mysql-5.5 mysqld

MySQL 可以正常运行数周或数天,然后突然且没有任何用户操作,所有连接尝试都开始失败。这是/var/log/mysqld.log

160916 14:42:01 [Note] /usr/libexec/mysql55/mysqld: ready for connections.
Version: '5.5.51'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
160930 03:05:51 mysqld_safe Number of processes running now: 0
160930 03:05:52 mysqld_safe mysqld restarted
160930  3:05:53 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.51) starting as process 8961 ...
160930  3:05:53 [Note] Plugin 'FEDERATED' is disabled.
160930  3:05:54 InnoDB: The InnoDB memory heap is disabled
160930  3:05:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160930  3:05:54 InnoDB: Compressed tables use zlib 1.2.8
160930  3:05:54 InnoDB: Using Linux native AIO
160930  3:05:54 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
160930  3:05:54 InnoDB: Completed initialization of buffer pool
160930  3:05:54 InnoDB: Fatal error: cannot allocate memory for the buffer pool
160930  3:05:54 [ERROR] Plugin 'InnoDB' init function returned error.
160930  3:05:54 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160930  3:05:54 [ERROR] Unknown/unsupported storage engine: InnoDB
160930  3:05:54 [ERROR] Aborting

160930  3:05:54 [Note] /usr/libexec/mysql55/mysqld: Shutdown complete

160930 03:05:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Run Code Online (Sandbox Code Playgroud)

这是什么原因造成的,我该如何处理?

Phi*_*lᵀᴹ 8

你在日志文件中看到了吗?

160930 3:05:54 InnoDB:致命错误:无法为缓冲池分配内存

您的主机上没有足够的可用内存。要么减少 MySQL 配置使用的内存量,要么增加主机/VM 的内存量。

由于内存不足,数据库无法启动。

首先推测数据库重启的原因,很可能是操作系统的OOM Killer在操作系统内存耗尽时选择了MySQL进程作为“唯一”进程。请参阅OOM 杀手如何决定首先杀死哪个进程?在 Unix.SE 上。

出现“未知/不支持的存储引擎”消息是因为 MySQL 已要求存储引擎 (InnoDB) 对其自身进行初始化,但由于内存不足而无法执行此操作。

160930 3:05:54 [错误] 插件“InnoDB”初始化函数返回错误。
160930 3:05:54 [错误] 插件“InnoDB”注册为存储引擎失败。
160930 3:05:54 [错误] 未知/不支持的存储引擎:InnoDB