2016年4月2日 星期六

MySQL error code 1286 Unknown storage engine 'InnoDB'" 錯誤處理紀錄

Azure上的DB因為LOG FILE因素Crash 重啟後出現 1286錯誤,在Mysql中innodb_plugin.so 載入是NO,INNODB引擎載入失敗所以DB出現未知錯誤。

經查LOG,buffer pool size=3G?? 這是甚麼神設定~這是後話...當初Google大神給的錯答案吧。

InnoDB: Initializing buffer pool, size = 3.0G
InnoDB: Error: cannot allocate 3221241856 bytes o
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 48401248 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
InnoDB: On FreeBSD check you have compiled the OS with
InnoDB: a big enough maximum process size.
InnoDB: Note that in most 32-bit computers the process
InnoDB: memory space is limited to 2 GB or 4 GB.

當時~感覺上就是記憶體空間不足,因為這是64位元電腦記憶體並沒有4GB限制,然後SWAP確實不足明顯Free Memory偏少,看來是Azure A1規模給的1.75GB RAM不夠用了造成,更改成A2規模有3.5GB的RAM後再重啟出現此錯誤。

Error: page 11704 log sequence number 0 1235697021
is in the future! Current system log sequence number 0 1226442301.
Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. See http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html for more information.

官網上就是說在my.cnf加上innodb_force_recovery = 1解釋就很清楚了但是Restart後依舊是
認得出InnoDB的Database,但是內容如Table, View ... 都消失了。看來是Log File搞的鬼...依照下面的步驟執行後就正常了。

  1. Revert any config changes you've made to the log file size and start MySQL again.
  2. In your running MySQL: SET GLOBAL innodb_fast_shutdown=0;
  3. Stop MySQL
  4. Make the configuration change to the log file size.
  5. Delete both log files. 不要刪掉ibData1這檔案
  6. Start MySQL. It will complain about the lack of log files, but it'll create them and all will be well.
PS. 記得把my.cnf裡面innodb_force_recovery設回0,不然DB是無法寫入的。

4/7 補充: 又crash了,更改設定值如下

innodb_flush_log_at_trx_commit  = 2   //Default = 1, 0:fast but unsafe
innodb_buffer_pool_size               = 256M
innodb_additional_mem_pool_size = 20M
innodb_lock_wait_timeout             = 50
innodb_log_file_size                      = 64M
innodb_log_buffer_size                  = 8M


沒有留言: