記一次mariadb數(shù)據(jù)庫無法連接
自從自己維護blog以后,基本一個月內(nèi),都會出現(xiàn)1,2次這種錯誤,以前解決的辦法很簡單,就是把虛擬機重啟一下就可以。經(jīng)常是網(wǎng)友在微信,qq,微博提醒我blog掛掉。
剛好國慶期間碰上,就順便提高一下自己的運維能力,看看具體的原因。
tail /var/log/mariadb/mariadb.log
看到大概的錯誤
161004 11:21:05 InnoDB: Fatal error: cannot allocate memory for the buffer pool
161004 11:21:05 [ERROR] Plugin 'InnoDB' init function returned error.
161004 11:21:05 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
161004 11:21:15 [Note] Plugin 'FEEDBACK' is disabled.
161004 11:21:16 [ERROR] Unknown/unsupported storage engine: InnoDB
161004 11:21:16 [ERROR] Aborting
其實我也能猜到,肯定是數(shù)據(jù)庫的內(nèi)存使用有啥問題。
有錯誤,其實就是利用google,基本就有答案
http://www.webtrafficexchange.com/solved-mysql-crash-fatal-error-cannot-allocate-memory-buffer-pool
我使用的青云的虛擬機,swap分區(qū),就是1G,所以應(yīng)該也不需要創(chuàng)建。
編輯 /etc/my.cnf,
[mysqld] innodb_buffer_pool_size=64M
重啟mysql
systemctl restart mariadb
查看swap內(nèi)存使用
# free -m total used free shared buff/cache available Mem: 993 431 386 6 175 424 Swap: 1023 0 1023
查看一下啟動日志
[root@chenshake mariadb]# tail /var/log/mariadb/mariadb.log
161004 20:42:46 InnoDB: Initializing buffer pool, size = 64.0M
161004 20:42:46 InnoDB: Completed initialization of buffer pool
161004 20:42:46 InnoDB: highest supported file format is Barracuda.
161004 20:42:46 InnoDB: Waiting for the background threads to start
密切關(guān)注一下后續(xù)的效果如何。
版權(quán)聲明:本站文章來源標注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場,如有內(nèi)容涉嫌侵權(quán),請聯(lián)系alex-e#qq.com處理。