MariaDB修行之路
每一次出问题都很开心,这代表着我又可以变强了.
解决想法
- 数据库不可连接怎么办?
- 频繁宕机怎么办?
- 我能怎么办?
当然是查看日志了
我的是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
查找关键字
- out of memory (内存溢出???)
解决方法
- 阿里云的机子,最便宜的,内存是动不了.
配置swap应应急吧
sudo dd if=/dev/zero of=/var/swap bs=1G count=4 #增加4G的SWAP进去
sudo mkswap /var/swap
sudo swapon /var/swap
free -h
- 关闭performance_schema
在配置文件的mysqld下面加
performance_schema = OFF
这个东西是个撒玩意呢?
我也不清楚,大概是个监控数据库执行的东东.在监控过程中会消耗内存.
咱们太穷了,就只能关了吧.