Home  >  Article  >  Database  >  mysql导致tmp目录空间耗尽问题_MySQL

mysql导致tmp目录空间耗尽问题_MySQL

WBOY
WBOYOriginal
2016-06-01 13:35:52992browse

bitsCN.com

mysql导致tmp目录空间耗尽问题

 

收到磁盘空间告警的信息,/tmp目录磁盘使用率99%。

mysql 的 tmpdir 设置在/tmp目录,第一时间查看 ls -alth 并为发现大文件,也没有mysql临时表之类的文件。

连接mysql,show processlist 并为发现异常查询 ……

 

整个/tmp目录8GB,用查看df -h 发现/tmp Avail 值剩下100MB左右;du -sh 发现tmp目录只用了几十MB。7GB多的空间哪里去了?未释放?

 

通过lsof |grep tmp |more 发现其中一个mysql实例很多类似 /tmp/MLXvlID8 (deleted)

 

mysql导致tmp目录空间耗尽问题_MySQL

 

查看mysqld.err中发现有多行: [ERROR] /mysql_base/bin/mysqld: Sort aborted

猜测:Sql异常终止,导致sort aborted 。而临时目录下的/tmp/ML****** 等文件虽然删除,但由于mysql线程连接是长连接,线程还存在,暂时不会释放空间。

 

若想释放空间:

1.重启mysql;

2.重启应用程序,断开长连接。

 

结果:

应用程序重启,长连接断开,删除的空间就释放了。

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn