天天看點

mysql 中ibtmp1檔案過大的問題

  • 問題描述

    生産環境linux suse11.4, 根目錄/ 下大小: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檔案(重新開機自動删除)

    5、啟動mysql服務

    注意:為了避免以後再出現類似的情況,一定要在限制臨時表空間的最大值,如innodb_temp_data_file_path = ibtmp1:12M:autoextend:max:5G

這樣重新開機後會發現提示

我就删除了 ibtmp1 結果提示

If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

innodb_system data file 'ibdata1' did not exist. A new tablespace will be created!

删除ib_logfile的檔案,就是說要移除就把ib* 的檔案一起移除;再嘗試啟動mysql服務;

繼續閱讀