MariaDB數據庫運行時宕機,出現不可連接

MariaDB修行之路

每一次出問題都很開心,這代表着我又可以變強了.

解決想法

  1. 數據庫不可連接怎麼辦?
  2. 頻繁宕機怎麼辦?
  3. 我能怎麼辦?

當然是查看日誌了

我的是Centos下的MariaDB..
日誌文件位於/var/log/mariaDB/

問題描述:


190529 15:24:13 mysqld_safe mysqld restarted
190529 15:24:13 [Note] /usr/libexec/mysqld (mysqld 5.5.60-MariaDB) starting as process 21737 ...
190529 15:24:14 [ERROR] mysqld: Out of memory (Needed 128917504 bytes)
190529 15:24:14 [ERROR] mysqld: Out of memory (Needed 96681984 bytes)
190529 15:24:14 InnoDB: The InnoDB memory heap is disabled
190529 15:24:14 InnoDB: Mutexes and rw_locks use GCC atomic builtins
190529 15:24:14 InnoDB: Compressed tables use zlib 1.2.7
190529 15:24:14 InnoDB: Using Linux native AIO
190529 15:24:14 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137756672 bytes) failed; errno 12
190529 15:24:14 InnoDB: Completed initialization of buffer pool
190529 15:24:14 InnoDB: Fatal error: cannot allocate memory for the buffer pool
190529 15:24:14 [ERROR] Plugin 'InnoDB' init function returned error.
190529 15:24:14 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
190529 15:24:14 [ERROR] Unknown/unsupported storage engine: InnoDB
190529 15:24:14 [ERROR] Aborting

查找關鍵字

  1. out of memory (內存溢出???)

解決方法

  1. 阿里雲的機子,最便宜的,內存是動不了.
配置swap應應急吧

sudo dd if=/dev/zero of=/var/swap bs=1M count=1024 #增加1G的SWAP進去
sudo mkswap /swapfile
sudo swapon /swapfile
free -h
  1. 關閉performance_schema
在配置文件的mysqld下面加
performance_schema = OFF

這個東西是個撒玩意呢?

我也不清楚,大概是個監控數據庫執行的東東.在監控過程中會消耗內存.
咱們太窮了,就只能關了吧.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章