周三一早回到公司,收到报警发现一台MySQL服务器异常,登入发现无法启动。该机器仅供临时测试使用,故此没有太多配置,查看err日志中发现
130629 5:46:48 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
130629 5:46:48 InnoDB: Completed initialization of buffer pool
130629 5:46:48 InnoDB: Fatal error: cannot allocate memory for the buffer pool
130629 5:46:48 [ERROR] Plugin 'InnoDB' init function returned error.
130629 5:46:48 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
130629 5:46:48 [ERROR] Unknown/unsupported storage engine: InnoDB
130629 5:46:48 [ERROR] Aborting
查看内存
$ free
total used free shared buffers cached
Mem: 608476 565044 43432 0 1284 53996
-/+ buffers/cache: 509764 98712
Swap: 0 0 0
好吧,明显的swap问题。适当增加swap,采用
$ sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 #增加1G的SWAP进去
$ sudo mkswap /swapfile
$ sudo swapon /swapfile
$ free
total used free shared buffers cached
Mem: 608476 601432 7044 0 824 88752
-/+ buffers/cache: 511856 96620
Swap: 1048572 0 1048572
此处不建议将swapon 写到/etc/fstab这里,直接写到/etc.rc.local中更为稳妥
启动解决...