- 9.1 备份与恢复类型9.1 Backup and Recovery Types
- 9.2 数据库备份方法9.2 Database Backup Methods
- 9.3 备份与恢复策略示例9.3 Example Backup and Recovery Strategy
- 9.4 使用 mysqldump 进行备份9.4 Using mysqldump for Backups
- 9.4.1 使用 mysqldump 以 SQL 格式导出数据9.4.1 Dumping Data in SQL Format with mysqldump
- 9.4.2 重新加载 SQL 格式备份9.4.2 Reloading SQL-Format Backups
- 9.4.3 使用 mysqldump 导出分隔文本格式的数据9.4.3 Dumping Data in Delimited-Text Format with mysqldump
- 9.4.4 重新加载分隔文本格式备份9.4.4 Reloading Delimited-Text Format Backups
- 9.4.5 mysqldump 小技巧9.4.5 mysqldump Tips
- 9.5 定点时间(增量)恢复9.5 Point-in-Time (Incremental) Recovery
- 9.6 MyISAM 表维护和崩溃恢复9.6 MyISAM Table Maintenance and Crash Recovery
- 9.6.1 使用 myisamchk 进行崩溃恢复9.6.1 Using myisamchk for Crash Recovery
- 9.6.2 如何检查 MyISAM 表的错误9.6.2 How to Check MyISAM Tables for Errors
- 9.6.3 如何修复 MyISAM 表9.6.3 How to Repair MyISAM Tables
- 9.6.4 MyISAM 表优化9.6.4 MyISAM Table Optimization
- 9.6.5 设置 MyISAM 表维护计划9.6.5 Setting Up a MyISAM Table Maintenance Schedule
备份您的数据库非常重要,这样在发生问题时(例如系统崩溃、硬件故障或用户误删数据),您可以恢复数据并再次正常运行。备份在升级 MySQL 安装之前也是作为安全保障的必需措施,同时它们还可以用于将 MySQL 安装迁移到另一台系统或设置副本服务器。It is important to back up your databases so that you can recover your data and be up and running again in case problems occur, such as system crashes, hardware failures, or users deleting data by mistake. Backups are also essential as a safeguard before upgrading a MySQL installation, and they can be used to transfer a MySQL installation to another system or to set up replica servers.
MySQL 提供了多种备份策略,您可以选择最符合您安装需求的方法。本章讨论了几个备份和恢复相关的主题,您应当熟悉:MySQL offers a variety of backup strategies from which you can choose the methods that best suit the requirements for your installation. This chapter discusses several backup and recovery topics with which you should be familiar:
备份类型:逻辑备份与物理备份、完全备份与增量备份等。Types of backups: Logical versus physical, full versus incremental, and so forth.
创建备份的方法。Methods for creating backups.
恢复方法,包括按时间点恢复。Recovery methods, including point-in-time recovery.
备份调度、压缩和加密。Backup scheduling, compression, and encryption.
表维护,以便恢复损坏的表。Table maintenance, to enable recovery of corrupt tables.
附加资源Additional Resources
与备份或维护数据可用性相关的资源包括以下内容:Resources related to backup or to maintaining data availability include the following:
MySQL 企业版的客户可以使用 MySQL Enterprise Backup 产品进行备份。有关 MySQL Enterprise Backup 产品概览,请参见 第 32.1 节,“MySQL Enterprise Backup 概览”。Customers of MySQL Enterprise Edition can use the MySQL Enterprise Backup product for backups. For an overview of the MySQL Enterprise Backup product, see Section 32.1, “MySQL Enterprise Backup Overview”.
有关备份问题的专用论坛可访问 https://forums.mysql.com/list.php?28。A forum dedicated to backup issues is available at https://forums.mysql.com/list.php?28.
mysqldump 的详细信息可以在 第 6 章,MySQL 程序 中找到。Details for mysqldump can be found in Chapter 6, MySQL Programs.
此处描述的 SQL 语句语法可参见 第 15 章,SQL 语句。The syntax of the SQL statements described here is given in Chapter 15, SQL Statements.
有关
InnoDB备份程序的更多信息,请参见 第 17.18.1 节,“InnoDB 备份”。For additional information aboutInnoDBbackup procedures, see Section 17.18.1, “InnoDB Backup”.复制使您能够在多个服务器上维护相同的数据。这有几个好处,例如可以将客户端查询负载分布在多个服务器上,即使某个服务器下线或出现故障,数据仍然可用,以及通过使用副本进行备份而不影响源的能力。请参见 第 19 章,复制。Replication enables you to maintain identical data on multiple servers. This has several benefits, such as enabling client query load to be distributed over servers, availability of data even if a given server is taken offline or fails, and the ability to make backups with no impact on the source by using a replica. See Chapter 19, Replication.
MySQL InnoDB 集群是一系列协同工作以提供高可用性解决方案的产品集合。一组 MySQL 服务器可以使用 MySQL Shell 配置以创建集群。服务器集群具有单一源,称为主服务器,它作为读写源。多个从服务器是该源的副本。创建高可用性集群至少需要三台服务器。客户端应用程序通过 MySQL Router 连接到主服务器。如果主服务器发生故障,一个从服务器会自动提升为主服务器,MySQL Router 将请求路由到新的主服务器。MySQL InnoDB Cluster is a collection of products that work together to provide a high availability solution. A group of MySQL servers can be configured to create a cluster using MySQL Shell. The cluster of servers has a single source, called the primary, which acts as the read-write source. Multiple secondary servers are replicas of the source. A minimum of three servers are required to create a high availability cluster. A client application is connected to the primary via MySQL Router. If the primary fails, a secondary is automatically promoted to the role of primary, and MySQL Router routes requests to the new primary.
NDB 集群提供了适用于分布式计算环境的高可用性、高冗余 MySQL 版本。请参见 第 25 章,MySQL NDB Cluster 8.4,其中提供了关于 MySQL NDB Cluster 8.4.7 的信息。NDB Cluster provides a high-availability, high-redundancy version of MySQL adapted for the distributed computing environment. See Chapter 25, MySQL NDB Cluster 8.4, which provides information about MySQL NDB Cluster 8.4.7.