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服務;

好了 

記得修改配置不要直接刪除文件 直接mv 修改下文件 萬一弄錯了呢

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章