Command-Line Format --innodb-fast-shutdown=#System Variable innodb_fast_shutdownScope Global Dynamic Yes SET_VARHint AppliesNo Type Integer Default Value 1Valid Values 012The
InnoDBshutdown mode. If the value is 0,InnoDBdoes a slow shutdown, a full purge and a change buffer merge before shutting down. If the value is 1 (the default),InnoDBskips these operations at shutdown, a process known as a fast shutdown. If the value is 2,InnoDBflushes its logs and shuts down cold, as if MySQL had crashed; no committed transactions are lost, but the crash recovery operation makes the next startup take longer.The slow shutdown can take minutes, or even hours in extreme cases where substantial amounts of data are still buffered. Use the slow shutdown technique before upgrading or downgrading between MySQL major releases, so that all data files are fully prepared in case the upgrade process updates the file format.
Use
innodb_fast_shutdown=2in emergency or troubleshooting situations, to get the absolute fastest shutdown if data is at risk of corruption.
InnoDB 关闭模式。
如果值为 0,InnoDB 会在关闭前进行缓慢关闭、完全清除和更改缓冲区合并。
如果值为 1(默认值),InnoDB 会在关闭时跳过这些操作,这个过程称为快速关闭。
如果值为 2,InnoDB 刷新其日志并冷关机,就好像 MySQL 崩溃了;没有提交的事务丢失,但崩溃恢复操作使下一次启动需要更长的时间。 在仍然缓冲大量数据的极端情况下,缓慢关闭可能需要几分钟甚至几小时。
在 MySQL 主要版本之间升级或降级之前使用慢速关闭技术,以便在升级过程更新文件格式时做好所有数据文件的准备。
在紧急情况或故障排除情况下使用 innodb_fast_shutdown=2,以在数据存在损坏风险时获得绝对最快的关闭速度。
A type of shutdown that does additional InnoDB flushing operations before completing. Also known as a clean shutdown. Specified by the configuration parameter innodb_fast_shutdown=0 or the command SET GLOBAL innodb_fast_shutdown=0;. Although the shutdown itself can take longer, that time should be saved on the subsequent startup.
一种关闭类型,在完成之前执行额外的 InnoDB 刷新操作。也称为干净关机。由配置参数 innodb_fast_shutdown=0 或命令 SET GLOBAL innodb_fast_shutdown=0; 指定。虽然关机本身可能需要更长的时间,但应该在后续启动时节省时间。
A type of garbage collection performed by one or more separate background threads (controlled by innodb_purge_threads) that runs on a periodic schedule. Purge parses and processes undo log pages from the history list for the purpose of removing clustered and secondary index records that were marked for deletion (by previous DELETE statements) and are no longer required for MVCC or rollback. Purge frees undo log pages from the history list after processing them.
一种由一个或多个单独的后台线程(由 innodb_purge_threads 控制)执行的垃圾收集,该线程定期运行。从历史列表中清除解析和处理撤消日志页面,以删除标记为删除(由以前的 DELETE 语句)且不再需要 MVCC 或回滚的聚集和二级索引记录。清除处理后从历史列表中释放撤消日志页面。
The default shutdown procedure for InnoDB, based on the configuration setting innodb_fast_shutdown=1. To save time, certain flush operations are skipped. This type of shutdown is safe during normal usage, because the flush operations are performed during the next startup, using the same mechanism as in crash recovery. In cases where the database is being shut down for an upgrade or downgrade, do a slow shutdown instead to ensure that all relevant changes are applied to the data files during the shutdown.
InnoDB 的默认关闭程序,基于配置设置 innodb_fast_shutdown=1。为了节省时间,会跳过某些刷新操作。这种类型的关闭在正常使用期间是安全的,因为刷新操作是在下次启动时执行的,使用与崩溃恢复相同的机制。如果数据库因升级或降级而关闭,请缓慢关闭以确保在关闭期间将所有相关更改应用于数据文件。
The cleanup activities that occur when MySQL is started again after a crash. For InnoDB tables, changes from incomplete transactions are replayed using data from the redo log. Changes that were committed before the crash, but not yet written into the data files, are reconstructed from the doublewrite buffer. When the database is shut down normally, this type of activity is performed during shutdown by the purge operation.
During normal operation, committed data can be stored in the change buffer for a period of time before being written to the data files. There is always a tradeoff between keeping the data files up-to-date, which introduces performance overhead during normal operation, and buffering the data, which can make shutdown and crash recovery take longer.
崩溃后再次启动 MySQL 时发生的清理活动。对于 InnoDB 表,使用重做日志中的数据重播来自不完整事务的更改。崩溃前已提交但尚未写入数据文件的更改将从双写缓冲区中重建。当数据库正常关闭时,这种类型的活动在关闭期间由清除操作执行。
在正常操作期间,提交的数据可以在更改缓冲区中存储一段时间,然后再写入数据文件。在保持数据文件最新(这会在正常操作期间引入性能开销)和缓冲数据(这会使关机和崩溃恢复需要更长的时间)之间总是需要权衡取舍。




