14.4.2 Changing the Number or Size of InnoDB Redo Log Files
To change the number or size of InnoDB redo log files in MySQL 5.6.7 or earlier, perform the following steps:
改变InnoDB redo log files的 number 或者size 在MySQL 5.6.7 或者更早,执行下面的步骤:
If innodb_fast_shutdown is set to 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.00 sec)
mysql> SET GLOBAL innodb_fast_shutdown = 1;
After ensuring that innodb_fast_shutdown is not set to 2, stop the MySQL server and make sure that it shuts down without errors (to ensure that there is no information for outstanding transactions
in the log).
当确认 innodb_fast_shutdown 不是设置为2,停止MySQL server ,关闭MYSQL 确保没有错误(
确保没有顺序事务的信息在日志里)
Copy the old log files into a safe place in case something went wrong during the shutdown and you need them to recover the tablespace.
复制老的日志文件到一个安全的地方,万一 在关闭阶段出现错误,你需要它们来恢复你的数据库
Delete the old log files from the log file directory.
删除老的日志文件从你的log file 目录
Edit my.cnf to change the log file configuration.
编辑my.cnf 来改变日志的设置
Start the MySQL server again. mysqld sees that no InnoDB log files exist at startup and creates new ones.
再次启动MySQL ,mysqld 看到没有Innodb LOG 文件存在在启动的时候 创建一个新的
As of MySQL 5.6.8, the innodb_fast_shutdown setting is no longer relevant when changing the number or the size of InnoDB log files. Additionally, you are no longer required remove old log files,
although you may still want to copy the old log files to a safe place, as a backup. To change the number or size of InnoDB log files, perform the following steps:
在MySQL 5.6.8, innodb_fast_shutdown 设置不再关联当改变number 或者InnoDB log files的大小
额外的,你也不需要删除老的文件。
尽管你可能需要拷贝老的文件到一个安全的地方,作为备份。 执行下面的步骤:
Stop the MySQL server and make sure that it shuts down without errors.
停止MySQL server,关闭没有错误
Edit my.cnf to change the log file configuration. To change the log file size, configure innodb_log_file_size. To increase the number of log files, configure innodb_log_files_in_group.
编辑my.cnf 来改变log file 配置。 configure innodb_log_file_size,增加log files 的大小, 配置innodb_log_files_in_group.
Start the MySQL server again.
启动MySQL server
If InnoDB detects that the innodb_log_file_size differs from the redo log file size, it will write a log checkpoint, close and remove the old log files, create new log files at the requested size,
and open the new log files.