MySQL測試環境遇到 mmap(xxx bytes) failed; errno 12解決方法


周三一早回到公司,收到報警發現一台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中更為穩妥

啟動解決...

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM