您的位置:首页 > 数据库 > MySQL

binlog日志太多太大耗尽磁盘空间导致mysql卡死的问题解决

2016-04-20 12:54 816 查看
今天有同事反馈,数据库卡死了,普通的一个带limit 1只反馈一条记录的查询都好久查不出来。

我查了一下,当前并没有阻塞信息,所以不是锁竞争导致的。

查看错误日志,看到了端倪:

160419 17:03:33 [ERROR]/usr/local/mysql/bin/mysqld: Disk is full writing './mysql-bin.000177'(Errcode: 28). Waiting for someone to free space... (Expect up to 60 secs delayfor server to co

ntinue after freeing disk space)

 

我进mysql数据目录查看,发现有很多以前的二进制日志,所以打算清空2015年所有的二进制日志。当我使用purge binary logs to清空二进制日志时,结果该命令也卡死了。晕!

解决办法:

先rm删除binlog日志,再purge binary logs to '具体的binlog'删除。

注意:purge binary logs to 'mysql-bin.00003'表示清理mysql-bin.00003之前的所有binlog,但不包括mysql-bin.00003本身。

注意:如果只rm,不purge,重启mysql的话,会报错的,mysql就起不来了。所以rm删除后,需要及时执行purge命令。

18:44:25 UTC - mysqld got signal 11 ;

This could be because you hit a bug. It isalso possible that this binary

or one of the libraries it was linkedagainst is corrupt, improperly built,

or misconfigured. This error can also becaused by malfunctioning hardware.

We will try our best to scrape up some infothat will hopefully help

diagnose the problem, but since we havealready crashed,

something is definitely wrong and this mayfail.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: