InnoDB的log file

88 views
Skip to first unread message

Ivan Tu

unread,
Nov 30, 2009, 2:23:48 AM11/30/09
to MySQL技術轉運站
MySQL眾多Storage Engine中InnoDB是用途最廣泛的Storage Engine,innodb log file是確保資料完
整性,和資料庫失敗時,資料回復性的一個重要工具,目前版本(5.1)的innodb log file無法自動更改innodb log file的
大小,當innodb log file的size設為固定時,是不能在option file(my.cnf)中改善其大小。若innodb
log file有損壞時亦不能自動修復。若要更改其大小,或innodb log file有毀損時,必須先停下MySQL,再將原innodb
log file移除,重開MySQL,讓MySQL 自動重新建立一個innodb log file.
最近有一用大型用戶的innodb lof file有問題,找我提供解決之道。其問題的摘要如下:

MySQL 出現了"ERROR 1033: Incorrect information file:"
這個錯誤會導致我們有許多 table 無法 query ,

查MySQL的Error log file中出現以下的訊息:

InnoDB: Error: log file ./ib_logfile0 is of different size 0
2097152000 bytes
InnoDB: than specified in the .cnf file 0 5242880 bytes!
091125 11:48:18 [ERROR] Plugin 'InnoDB' init function returned error.
091125 11:48:18 [ERROR] Plugin 'InnoDB' registration as a STORAGE
ENGINE failed.

我的回答列⺬於下列回覆中:

Ivan Tu

unread,
Nov 30, 2009, 2:34:26 AM11/30/09
to MySQL技術轉運站
Most likely, it is the size of innodb log file been changed in the
option file - my.cnf, or ib_logfile0 is corrupted. You may shutdown
the DB and move ib_logfile0 to other folder, then start MySQL, let
MySQL create a new log file for you.

from InnoDB's view point it is not a bug but a restriction (it
happened only when the log file is corrupted or a wrong option file is
applied).
To prevent such situation, there are 2 options:
1. apply your own option file by start DB with --defaults-
file=<your_my.cnf_path> option, and remove the edit privilege from
other accounts of the OS, if you do need to change the size of the log
file please apply the following procedure - shutdown the DB, move out
(rename) the log file, start the DB with new options and let DB create
a new log file for you. If every thing went fine, delete the original
innodb log file.
2. apply RAID 10 with the file system, to increase the tolerant with
file corruption.

Ivan Tu

unread,
Nov 30, 2009, 11:37:39 PM11/30/09
to MySQL技術轉運站
將上述回答轉成中文以利閱讀,
最有可能的原因是MySQL的option檔-通常是my.cnf中的innodb log file的大小被改變了。其次是innodb的log
file毀損了。解決的方式是移除innodb log file或更改innodb的log file的名稱,讓MySQL在重開時自動重建
innodb log file.
InnoDB不認為這種情形是bug,而是一個限制。用以下做法可避免這種狀況出現:
1。用database instance自有的option file,不用/etc/my.cnf當option file,做法是在開啟
MySQL時加--defaults-file=<path_to_my.cnf>的option,並且將database的option file的
修改權限取銷
2。用RAID 10 file system存innodb log file,以增加其容錯性
Reply all
Reply to author
Forward
0 new messages