MySQL 修改InnoDB重做日誌檔案的數量或大小
修改InnoDB重做日誌檔案的數量或大小
修改你的InnoDB重做日誌檔案的數量或大小,請執行以下步驟:
1.停止MySQL伺服器,並確保它沒有錯誤地關閉
mysql> show variables like 'innodb_log_file%'; +---------------------------+----------+ | Variable_name | Value | +---------------------------+----------+ | innodb_log_file_size | 50331648 | | innodb_log_files_in_group | 2 | +---------------------------+----------+ 2 rows in set (0.00 sec) [root@localhost ~]# service mysqld stop Shutting down MySQL.... SUCCESS!
2.編輯my.cnf以更改日誌檔案配置。如果需要修改日誌檔案大小,請配置innodb_log_file_size。要增加日誌檔案的數量,可以配置
innodb_log_files_in_group。 [mysql@localhost mysql]$ vi my.cnf .... innodb_log_file_size=100m innodb_log_files_in_group=3
3.重新啟動MySQL伺服器
如果InnoDB檢測到innodb_log_file_size大小與重做日誌檔案大小不同,它會寫一個日誌檢查點,關閉並刪除舊的日誌檔案,建立新的大小的志檔案,並開啟新的日誌檔案。
[root@localhost ~]# service mysqld start Starting MySQL.................................. SUCCESS!
日誌檔案顯示如下:
[mysql@localhost mysql]$ tail -f mysql.err 2022-03-02T02:44:15.775252Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path. 2022-03-02T02:44:15.775476Z 0 [Note] /mysqlsoft/mysql/bin/mysqld (mysqld 5.7.26-log) starting as process 613 ... 2022-03-02T02:44:15.787224Z 0 [Note] InnoDB: PUNCH HOLE support available 2022-03-02T02:44:15.787311Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2022-03-02T02:44:15.787376Z 0 [Note] InnoDB: Uses event mutexes 2022-03-02T02:44:15.787395Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2022-03-02T02:44:15.787411Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 2022-03-02T02:44:15.788175Z 0 [Note] InnoDB: Number of pools: 1 2022-03-02T02:44:15.788515Z 0 [Note] InnoDB: Using CPU crc32 instructions 2022-03-02T02:44:15.793577Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2022-03-02T02:44:15.812360Z 0 [Note] InnoDB: Completed initialization of buffer pool 2022-03-02T02:44:15.817437Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). 2022-03-02T02:44:15.862640Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2022-03-02T02:44:16.043532Z 0 [Warning] InnoDB: Resizing redo log from 2*3072 to 3*6400 pages, LSN=2494312 2022-03-02T02:44:16.169341Z 0 [Warning] InnoDB: Starting to delete and rewrite log files. 2022-03-02T02:44:16.200462Z 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 100 MB 2022-03-02T02:44:16.200745Z 0 [Note] InnoDB: Progress in MB: 100 2022-03-02T02:44:26.280622Z 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 100 MB 2022-03-02T02:44:26.281005Z 0 [Note] InnoDB: Progress in MB: 100 2022-03-02T02:44:37.028157Z 0 [Note] InnoDB: Setting log file ./ib_logfile2 size to 100 MB 2022-03-02T02:44:37.029053Z 0 [Note] InnoDB: Progress in MB: 100 2022-03-02T02:44:47.532468Z 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2022-03-02T02:44:47.532675Z 0 [Warning] InnoDB: New log files created, LSN=2494312 2022-03-02T02:44:47.533502Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2022-03-02T02:44:47.533760Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2022-03-02T02:44:48.119249Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2022-03-02T02:44:48.121693Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2022-03-02T02:44:48.121740Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2022-03-02T02:44:48.122598Z 0 [Note] InnoDB: Waiting for purge to start 2022-03-02T02:44:48.172771Z 0 [Note] InnoDB: page_cleaner: 1000ms intended loop took 32356ms. The settings might not be optimal. (flushed=0 and evicted=0, during the time.) 2022-03-02T02:44:48.186082Z 0 [Note] InnoDB: 5.7.26 started; log sequence number 2494303 2022-03-02T02:44:48.186431Z 0 [Note] InnoDB: Loading buffer pool(s) from /mysqldata/mysql/ib_buffer_pool 2022-03-02T02:44:48.186776Z 0 [Note] Plugin 'FEDERATED' is disabled. 2022-03-02T02:44:48.366419Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2022-03-02T02:44:48.367248Z 0 [Warning] CA certificate ca.pem is self signed. 2022-03-02T02:44:48.369110Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 2022-03-02T02:44:48.371083Z 0 [Note] IPv6 is available. 2022-03-02T02:44:48.371145Z 0 [Note] - '::' resolves to '::'; 2022-03-02T02:44:48.371213Z 0 [Note] Server socket created on IP: '::'. 2022-03-02T02:44:48.430720Z 0 [Note] InnoDB: Buffer pool(s) load completed at 220302 10:44:48 2022-03-02T02:44:48.434777Z 0 [Note] Failed to start slave threads for channel '' 2022-03-02T02:44:48.452218Z 0 [Note] Event Scheduler: Loaded 0 events 2022-03-02T02:44:48.452566Z 0 [Note] /mysqlsoft/mysql/bin/mysqld: ready for connections. Version: '5.7.26-log' socket: '/mysqlsoft/mysql/mysql.sock' port: 3306 Source distribution
其中以下部分顯示了伺服器重置日誌檔案的大小與數量
2022-03-02T02:44:16.043532Z 0 [Warning] InnoDB: Resizing redo log from 2*3072 to 3*6400 pages, LSN=2494312 2022-03-02T02:44:16.169341Z 0 [Warning] InnoDB: Starting to delete and rewrite log files. 2022-03-02T02:44:16.200462Z 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 100 MB 2022-03-02T02:44:16.200745Z 0 [Note] InnoDB: Progress in MB: 100 2022-03-02T02:44:26.280622Z 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 100 MB 2022-03-02T02:44:26.281005Z 0 [Note] InnoDB: Progress in MB: 100 2022-03-02T02:44:37.028157Z 0 [Note] InnoDB: Setting log file ./ib_logfile2 size to 100 MB 2022-03-02T02:44:37.029053Z 0 [Note] InnoDB: Progress in MB: 100 2022-03-02T02:44:47.532468Z 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2022-03-02T02:44:47.532675Z 0 [Warning] InnoDB: New log files created, LSN=2494312 [mysql@localhost ~]$ mysql -uroot -pxxzx7817600 mysql mysql: [Warning] Using a password on the command line interface can be insecure. Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.26-log Source distribution Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show variables like 'innodb_log_file%'; +---------------------------+-----------+ | Variable_name | Value | +---------------------------+-----------+ | innodb_log_file_size | 104857600 | | innodb_log_files_in_group | 3 | +---------------------------+-----------+ 2 rows in set (0.01 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2871765/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL InnoDB日誌檔案配置MySql
- MySQL 5.6修改REDO日誌的大小和個數MySql
- MySQL重做日誌(redo log)MySql
- Oracle11g redo log 建立、新增、刪除(重做日誌組,重做日誌檔案)Oracle
- 記錄一則clear重做日誌檔案的案例
- Postgres使用pg_resetwal命令修改wal日誌檔案大小的方法
- 限制 Apache日誌檔案大小的方法Apache
- MySQL重做日誌恢復資料的流程MySql
- 【MySQL日誌】MySQL日誌檔案初級管理MySql
- 重做日誌管理
- 探究MySQL中的日誌檔案MySql
- mysql的日誌檔案詳解MySql
- 【趙渝強老師】MySQL的全量日誌檔案MySql
- 【Oracle】如何修改資料檔案和日誌檔案的路徑Oracle
- 達夢資料庫DM8之REDOLOG重做日誌檔案管理資料庫
- MySQL InnoDB Cluster如何定位或找出超過事務大小的SQL?MySql
- Archived Redo Logs歸檔重做日誌介紹及其優點Hive
- MySQL技術內幕之“日誌檔案”MySql
- Mysql慢查詢日誌檔案轉ExcelMySqlExcel
- 【趙渝強老師】MySQL的binlog日誌檔案MySql
- MySQL中的日誌檔案 你全都瞭解嗎?MySql
- MySQL InnoDB頁面大小配置MySql
- MySQL提升筆記(3)日誌檔案詳解MySql筆記
- MySQL資料庫中常見的日誌檔案彙總!MySql資料庫
- mysql 資料儲存檔案及6類日誌MySql
- 淺談MySQL日誌檔案|手撕MySQL|對線面試官MySql面試
- MySQL:如何快速的檢視Innodb資料檔案MySql
- java專案日誌配置檔案Java
- GTID中MySQL啟動時間慢?二進位制日誌檔案大小可能是問題MySql
- 教你自動恢復MySQL資料庫的日誌檔案(binlog)MySql資料庫
- mysql學習8:第四章:資料庫檔案--日誌檔案MySql資料庫
- selenium-日誌檔案的使用(十二)
- 日誌檔案過大清理
- sybase iq日誌檔案管理
- 在Linux中,有一堆日誌檔案,如何刪除7天前的日誌檔案?Linux
- MySQL 減少InnoDB系統表空間的大小MySql
- MySQL 增加InnoDB系統表空間大小MySql
- linux查詢某段時間修改的檔案的總大小Linux