14.4.2 Changing the Number or Size of InnoDB Redo Log Files 改变 InnoDB Redo Log Fiels 的大小和数量
改变InnoDB redo log 文件的大小和数量 在MySQL 5.6.7 或者更早的版本,
执行下面的操作:
1.如果innodb_fast_shutdown 是设置为2, set innodb_fast_shutdown to 1:
mysql> show variables like ‘%innodb_fast_shutdown%’;
+———————-+——-+
| Variable_name | Value |
+———————-+——-+
| innodb_fast_shutdown | 1 |
+———————-+——-+
1 row in set (0.01 sec)
mysql> SET GLOBAL innodb_fast_shutdown = 1;
2.在确保 innodb_fast_shutdown 没有设置为2,停止MySQL 确保关闭没有错误( 确保日志中没有未完成交易的信息)
3.复制老的log files 到一个安全的地方 以防发生出错 在关闭期间和你需要恢复表空间
- 删除old log files 从log file directory
5.编辑my.cnf 来改变log file 配置
- 启动MySQL server again,mysqld 看到没有InnoDB log fils 创建新的log files.
在MySQL 5.6.8,innodb_fast_shutdown 设置不在关联当改变 InnoDB log files的大小和数量。
此外,你不在需要删除删除老的log files,尽管你仍旧需要复制老的log files 到一个安全的地方作为备份。
改变InnoDB log files的大小和数量,执行下面的步骤:
1.停止MySQL server 和确保关闭没有错误
2.编辑my.cnf 改变log file 配置,改变log file size,配置innodb_log_file_size。
增加log files 的数量,配置innodb_log_files_in_group.
如果InnoDB 检测到innodb_log_file_size 不同于redo log file size, 它会写一个log checkpoint,
关闭和删除old log files,创建新的log 文件在请求的大小, 打开新的log files: