ibtmp1文件过大
admin
2023-04-23 18:22:47
0

有个数据库发现磁盘告警 已经100% 经过排查发现数据库的data目录下有个

ibtmp1文件过大

ibtmp1是个什么东西呢?查看官方文档后发现

The temporary tablespace is a tablespace for non-compressed InnoDB temporary tables and related objects. The configuration option, innodb_temp_data_file_path, defines a relative path for the temporary tablespace data file. If innodb_temp_data_file_path is not defined, a single auto-extending 12MB data file named ibtmp1 is created in the data directory. The temporary tablespace is recreated on each server start and receives a dynamically generated space ID, which helps avoid conflicts with existing space IDs. The temporary tablespace cannot reside on a raw device. Startup is refused if the temporary tablespace cannot be created.

The temporary tablespace is removed on normal shutdown or on an aborted initialization. The temporary tablespace is not removed when a crash occurs. In this case, the database administrator may remove the temporary tablespace manually or restart the server with the same configuration, which removes and recreates the temporary tablespace

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

该参数是5.7的新特性

针对临时表及相关对象引入新的“non-redo” undo log,存放于临时表空间。该类型的undo log非 redolog 因为临时表不需崩溃恢复、也就无需redo logs,但却需要 undo log用于回滚、MVCC等。默认的临时表空间文件为ibtmp1,位于数据目录在每次服务器启动时被重新创建,可通过innodb_temp_data_file_path指定临时表空间。(http://dev.mysql.com/doc/refman/5.7/en/innodb-temporary-table-undo-logs.html)


解决办法:

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文件

5,启动mysql服务


注意:为了避免以后再出现类似的情况,一定要在限制临时表空间的最大值,如innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G


相关内容

热门资讯

王虹赴法留学推荐信首次曝光,由... 7月28日,王虹推荐信 话题词冲上热搜第一。记者查询发现,近日刚获得有“数学界诺贝尔奖”美誉的菲尔兹...
原创 中... 柏林郊外一块不起眼的试验田里,几个德国研究员蹲在白菜地里忙活了三四年。他们手上那瓶液体不是化肥店买来...
原创 2... 新能源车这些年跑得飞快,可有个心结一直没解开。车主晚上把车停进地库,心里多少还是打个鼓——万一它半夜...
“最强模型”公开,人人都可自由... 7月27日深夜,月之暗面(Moonshot AI)宣布开源Kimi K3模型权重,发布47页技术报告...
MIT给VLA加“外挂”,让机... 视觉—语言—动作模型(VLA)已经能够完成不少复杂的机器人任务,但在实际运行中,机器人通常需要先停下...
华硕Intel 800系主板助... 随着本地大模型、AI绘图、AI视频生成以及智能办公等应用快速普及,AI主机正逐渐成为2026年DIY...
“七姐妹”市值一夜蒸发5.8万... 出品 | 搜狐科技 作者 | 梁昌均 美股遭遇“黑色星期四”。最新交易日,美股三大指数集体重挫,纳指...
OpenAI智能体攻击范围扩大... 【CNMO科技消息】7月29日,据路透社报道,此前引发关注的OpenAI智能体入侵Hugging F...
华为苹果正面硬刚 华为Mate... PChome 7月29日消息,据数码闲聊站爆料,国内手机品牌将于9月举办两场重磅发布会,9月上旬推出...