不灭的焱

革命尚未成功,同志仍须努力下载JDK17

作者:Albert.Wen  添加时间:2023-01-02 17:39:14  修改时间:2024-04-30 08:19:09  分类:MySQL/Redis  编辑

问题描述

生产环境CentOS 7, 根目录/ 下大小:50G, ibtmp1大小:31G, 磁盘空间爆满100%告警。

ibtmp1文件说明

ibtmp1是非压缩的innodb临时表的独立表空间,通过innodb_temp_data_file_path参数指定文件的路径,文件名和大小,默认配置为ibtmp1:12M:autoextend,也就是说在支持大文件的系统这个文件大小是可以无限增长的。

解决办法

1、修改my.cnf配置文件:

innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G

2、设置innodb_fast_shutdown参数

SET GLOBAL innodb_fast_shutdown = 0;  #InnoDB does a slow shutdown, a full purge and a change buffer merge before shutting down

3、关闭MySQL服务

4、删除ibtmp1文件(MySQL重启后,会自动删除)

5、启动MySQL服务

注意:为了避免以后再出现类似的情况,一定要在限制临时表空间的最大值,如

innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G