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=1G count=4 #增加4G的SWAP进去
sudo mkswap /var/swap
sudo swapon /var/swap
free -h
  1. 关闭performance_schema
在配置文件的mysqld下面加
performance_schema = OFF

这个东西是个撒玩意呢?

我也不清楚,大概是个监控数据库执行的东东.在监控过程中会消耗内存.
咱们太穷了,就只能关了吧.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值