在操作系统崩溃或断电的情况下,InnoDB 本身会完成数据恢复的所有工作。但为了确保您能安心睡觉,请遵守以下指南:In case of an operating system crash or power failure,
InnoDB itself does all the job of recovering
data. But to make sure that you can sleep well, observe the
following guidelines:
始终启用二进制日志运行 MySQL 服务器(这是 MySQL 8.4 的默认设置)。如果你有这种安全介质,这种技术也可以用于磁盘负载平衡(从而提高性能)。Always tun the MySQL server with binary logging enabled (that is the default setting for MySQL 8.4). If you have such safe media, this technique can also be good for disk load balancing (which results in a performance improvement).
定期进行完整备份,使用前面在mysqldump命令中展示的方式,在第 9.3.1 节,“建立备份策略”中,这可以进行在线非阻塞备份。Make periodic full backups, using the mysqldump command shown earlier in Section 9.3.1, “Establishing a Backup Policy”, that makes an online, nonblocking backup.
通过使用
FLUSH LOGS或mysqladmin flush-logs来清空日志,定期进行增量备份。Make periodic incremental backups by flushing the logs withFLUSH LOGSor mysqladmin flush-logs.