MySQL 5.6修改REDO日誌的大小和個數

feelpurple發表於2018-05-28
一套線上環境的REDO日誌的大小和格式設定的不合理,需要將日誌大小修改成2G,個數改為5個。

  1. # 修改引數檔案
  2. # vi /etc/my_56.cnf
  3. innodb_log_file_size = 2G
  4. innodb_log_files_in_group = 5

  5. # 重啟資料庫

  6. # 啟動的時候,檢視錯誤日誌,可以看到重新初始化了REDO日誌
  7. 2018-05-28 09:40:54 25439 [Note] Plugin 'FEDERATED' is disabled.
  8. 2018-05-28 09:40:54 25439 [Note] InnoDB: Using atomics to ref count buffer pool pages
  9. 2018-05-28 09:40:54 25439 [Note] InnoDB: The InnoDB memory heap is disabled
  10. 2018-05-28 09:40:54 25439 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
  11. 2018-05-28 09:40:54 25439 [Note] InnoDB: Memory barrier is not used
  12. 2018-05-28 09:40:54 25439 [Note] InnoDB: Compressed tables use zlib 1.2.3
  13. 2018-05-28 09:40:54 25439 [Note] InnoDB: Using Linux native AIO
  14. 2018-05-28 09:40:54 25439 [Note] InnoDB: Using CPU crc32 instructions
  15. 2018-05-28 09:40:54 25439 [Note] InnoDB: Initializing buffer pool, size = 1.0G
  16. 2018-05-28 09:40:55 25439 [Note] InnoDB: Completed initialization of buffer pool
  17. 2018-05-28 09:40:55 25439 [Note] InnoDB: Highest supported file format is Barracuda.
  18. 2018-05-28 09:40:55 25439 [Warning] InnoDB: Resizing redo log from 2*3072 to 5*131072 pages, LSN=19620839567
  19. 2018-05-28 09:40:55 25439 [Warning] InnoDB: Starting to delete and rewrite log files.
  20. 2018-05-28 09:40:55 25439 [Note] InnoDB: Setting log file ./ib_logfile101 size to 2048 MB
  21. InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000
  22. 2018-05-28 09:41:06 25439 [Note] InnoDB: Setting log file ./ib_logfile1 size to 2048 MB
  23. InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000
  24. 2018-05-28 09:41:16 25439 [Note] InnoDB: Setting log file ./ib_logfile2 size to 2048 MB
  25. InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000
  26. 2018-05-28 09:41:26 25439 [Note] InnoDB: Setting log file ./ib_logfile3 size to 2048 MB
  27. InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000
  28. 2018-05-28 09:41:36 25439 [Note] InnoDB: Setting log file ./ib_logfile4 size to 2048 MB
  29. InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000
  30. 2018-05-28 09:41:46 25439 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
  31. 2018-05-28 09:41:46 25439 [Warning] InnoDB: New log files created, LSN=19620839567
  32. 2018-05-28 09:41:46 25439 [Note] InnoDB: 128 rollback segment(s) are active.
  33. 2018-05-28 09:41:46 25439 [Note] InnoDB: Waiting for purge to start
  34. 2018-05-28 09:41:46 25439 [Note] InnoDB: 5.6.39 started; log sequence number 19620839567
  35. 2018-05-28 09:41:46 25439 [Note] Server hostname (bind-address): '*'; port: 3306
  36. 2018-05-28 09:41:46 25439 [Note] IPv6 is available.

  37. # 啟動成功後,檢視REDO日誌的大小
  38. mysql> show global variables like '%innodb_log_file_size%';
  39. +----------------------+------------+
  40. | Variable_name | Value |
  41. +----------------------+------------+
  42. | innodb_log_file_size | 2147483648 |
  43. +----------------------+------------+
  44. 1 row in set (0.01 sec)

  45. mysql> show global variables like '%innodb_log_files_in_group%';
  46. +---------------------------+-------+
  47. | Variable_name | Value |
  48. +---------------------------+-------+
  49. | innodb_log_files_in_group | 5 |
  50. +---------------------------+-------+
  51. 1 row in set (0.01 sec)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2155223/,如需轉載,請註明出處,否則將追究法律責任。

相關文章