下午接到一個(gè)磁盤(pán)告警,一個(gè)ibtmp1文件占用5.4T磁盤(pán)空間,首先這個(gè)不是tmp目錄下的臨時(shí)文件,也不是日志文件。所以以為就是業(yè)務(wù)寫(xiě)的數(shù)據(jù)導(dǎo)致磁盤(pán)滿。
后面查了一下,得知這個(gè)是非壓縮的innodb臨時(shí)表的獨(dú)立表空間:
MySQL [(none)]> show variables like '%innodb_temp_data_file_path%';
+----------------------------+-----------------------+
| Variable_name | Value |
+----------------------------+-----------------------+
| innodb_temp_data_file_path | ibtmp1:12M:autoextend |
+----------------------------+-----------------------+
緊急處理辦法:
1)、SET GLOBAL innodb_fast_shutdown = 0;
2)、關(guān)閉mysql服務(wù)
3)、查看ibtmp1文件是不是在變小,也可以刪除該文件
4)、重啟mysql
注意:為了避免以后再出現(xiàn)類似的情況,一定要在限制臨時(shí)表空間的最大值,如innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G