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

一:问题描述

今天有同事反馈,数据库卡死了,普通的一个带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.

你可能感兴趣的:(1,MySql,学习,#,MySql,报错集锦,#,Mysql,故障处理)