记一次mariadb数据库无法连接
自从自己维护blog以后,基本一个月内,都会出现1,2次这种错误,以前解决的办法很简单,就是把虚拟机重启一下就可以。经常是网友在微信,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
其实我也能猜到,肯定是数据库的内存使用有啥问题。
有错误,其实就是利用google,基本就有答案
我使用的青云的虚拟机,swap分区,就是1G,所以应该也不需要创建。
编辑 /etc/my.cnf,
[mysqld] innodb_buffer_pool_size=64M
重启mysql
systemctl restart mariadb
查看swap内存使用
# 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
密切关注一下后续的效果如何。
相关文章:
1. centos 7安装mysql5.5和安装 mariadb使用的命令2. MySQL/MariaDB中如何支持全部的Unicode3. 详谈MySQL和MariaDB区别与性能全面对比4. 详解Centos 使用YUM安装MariaDB5. Windows Server 2016 服务器配置指南 之 MariaDB数据库环境搭建方法6. Window7安装MariaDB数据库及系统初始化操作分析7. centos中找回MariaDB数据库root用户权限的方法8. 我是如何用2个Unix命令给MariaDB SQL提速的9. Mysql/MariaDB启动时处于进度条状态导致启动失败的原因及解决办法10. Mac中MariaDB数据库的安装步骤

网公网安备