在 Azure Database for MariaDB 中进行备份和还原Backup and restore in Azure Database for MariaDB

Azure Database for MariaDB 可自动创建服务器备份并将其存储在用户配置的本地冗余或异地冗余存储中。Azure Database for MariaDB automatically creates server backups and stores them in user configured locally redundant or geo-redundant storage. 备份可以用来将服务器还原到某个时间点。Backups can be used to restore your server to a point-in-time. 备份和还原是任何业务连续性策略的基本组成部分,因为它们可以保护数据免遭意外损坏或删除。Backup and restore are an essential part of any business continuity strategy because they protect your data from accidental corruption or deletion.

备份Backups

Azure Database for MariaDB 可以进行完整备份、差异备份和事务日志备份。Azure Database for MariaDB takes full, differential, and transaction log backups. 可以通过这些备份将服务器还原到所配置的备份保留期中的任意时间点。These backups allow you to restore a server to any point-in-time within your configured backup retention period. 默认的备份保留期为七天。The default backup retention period is seven days. 可以选择将其配置为长达 35 天。You can optionally configure it up to 35 days. 所有备份都使用 AES 256 位加密进行加密。All backups are encrypted using AES 256-bit encryption.

这些备份文件未公开给用户,因此无法导出。These backup files are not user-exposed and cannot be exported. 这些备份只能用于 Azure Database for MariaDB 中的还原操作。These backups can only be used for restore operations in Azure Database for MariaDB. 可以使用 mysqldump 复制数据库。You can use mysqldump to copy a database.

备份频率Backup frequency

通常情况下,完整备份每周进行一次,差异备份每天进行两次,事务日志备份每五分钟进行一次。Generally, full backups occur weekly, differential backups occur twice a day, and transaction log backups occur every five minutes. 第一次完整备份在创建服务器后立即进行计划。The first full backup is scheduled immediately after a server is created. 初始备份在大型已还原服务器上可能耗时较长。The initial backup can take longer on a large restored server. 新服务器可以还原到的最早时间点是完成初始完整备份的时间。The earliest point in time that a new server can be restored to is the time at which the initial full backup is complete.

备份冗余选项Backup redundancy options

使用 Azure Database for MariaDB 时,可以灵活地在“常规用途”层和“内存优化”层中选择本地冗余或异地冗余备份存储。Azure Database for MariaDB provides the flexibility to choose between locally redundant or geo-redundant backup storage in the General Purpose and Memory Optimized tiers. 当备份存储在异地冗余备份存储中时,这些备份不仅会存储在托管服务器所在的区域中,还会复制到配对的数据中心。When the backups are stored in geo-redundant backup storage, they are not only stored within the region in which your server is hosted, but are also replicated to a paired data center. 这样可以在发生灾难时提供更好的保护,并且可以将服务器还原到其他区域。This provides better protection and ability to restore your server in a different region in the event of a disaster. “基本”层仅提供本地冗余备份存储。The Basic tier only offers locally redundant backup storage.

重要

只能在服务器创建期间为备份配置本地冗余或异地冗余存储。Configuring locally redundant or geo-redundant storage for backup is only allowed during server create. 预配服务器以后,不能更改备份存储冗余选项。Once the server is provisioned, you cannot change the backup storage redundancy option.

备份存储成本Backup storage cost

Azure Database for MariaDB 最高可以提供 100% 的已预配服务器存储作为备份存储,不收取任何额外费用。Azure Database for MariaDB provides up to 100% of your provisioned server storage as backup storage at no additional cost. 通常情况下,这适合将备份保留七天。Typically, this is suitable for a backup retention of seven days. 超出的备份存储使用量按每月每 GB 标准收费。Any additional backup storage used is charged in GB-month.

例如,如果为服务器预配了 250 GB,则有 250 GB 不额外收费的备份存储。For example, if you have provisioned a server with 250 GB, you have 250 GB of backup storage at no additional charge. 存储超出 250 GB 就会收费。Storage in excess of 250 GB is charged.

有关备份存储成本的更多信息,请访问 MariaDB 定价页面For more information on backup storage cost, visit the MariaDB pricing page.

还原Restore

在 Azure Database for MariaDB 中进行还原时,会根据原始服务器的备份创建新的服务器并还原服务器中包含的所有数据库。In Azure Database for MariaDB, performing a restore creates a new server from the original server's backups and restores all databases contained in the server.

可以使用两种类型的还原:There are two types of restore available:

  • 时间点还原可通过任一备份冗余选项使用,并利用完整备份和事务日志备份的组合在原始服务器所在区域中创建一个新服务器。Point-in-time restore is available with either backup redundancy option and creates a new server in the same region as your original server utilizing the combination of full and transaction log backups.
  • 异地还原仅在你为服务器配置了异地冗余存储时可用,它允许你利用最近进行的备份将服务器还原到其他区域。Geo-restore is available only if you configured your server for geo-redundant storage and it allows you to restore your server to a different region utilizing the most recent backup taken.

估计的恢复时间取决于若干因素,包括数据库大小、事务日志大小、网络带宽,以及在同一区域同时进行恢复的数据库总数。The estimated time of recovery depends on several factors including the database sizes, the transaction log size, the network bandwidth, and the total number of databases recovering in the same region at the same time. 恢复时间通常少于 12 小时。The recovery time is usually less than 12 hours.

重要

已删除的服务器无法还原。Deleted servers cannot be restored. 如果删除服务器,则属于该服务器的所有数据库也会被删除且不可恢复。为了防止服务器资源在部署后遭意外删除或意外更改,管理员可以利用管理锁If you delete the server, all databases that belong to the server are also deleted and cannot be recovered.To protect server resources, post deployment, from accidental deletion or unexpected changes, administrators can leverage management locks.

时间点还原Point-in-time restore

可以还原到备份保留期中的任意时间点,不管备份冗余选项如何。Independent of your backup redundancy option, you can perform a restore to any point in time within your backup retention period. 新服务器在原始服务器所在的 Azure 区域中创建。A new server is created in the same Azure region as the original server. 它在创建时,使用原始服务器在定价层、计算的代、vCore 数、存储大小、备份保留期和备份冗余选项方面的配置。It is created with the original server's configuration for the pricing tier, compute generation, number of vCores, storage size, backup retention period, and backup redundancy option.

多种情况下可以使用时间点还原。Point-in-time restore is useful in multiple scenarios. 例如,用户意外删除了数据、删除了重要的表或数据库,或者应用程序因为缺陷而意外地使用错误数据覆盖了正确数据。For example, when a user accidentally deletes data, drops an important table or database, or if an application accidentally overwrites good data with bad data due to an application defect.

可能需要等到下一个事务日志备份进行后,才能还原到上一个五分钟内的某个时间点。You may need to wait for the next transaction log backup to be taken before you can restore to a point in time within the last five minutes.

异地还原Geo-restore

如果已将服务器配置为进行异地冗余备份,则可将服务器还原到另一 Azure 区域,只要服务在该区域可用即可。You can restore a server to another Azure region where the service is available if you have configured your server for geo-redundant backups. 当服务器因其所在的区域发生事故而不可用时,异地还原是默认的恢复选项。Geo-restore is the default recovery option when your server is unavailable because of an incident in the region where the server is hosted. 如果区域中出现的大规模事件导致数据库应用程序不可用,可以根据异地冗余备份将服务器还原到任何其他区域中的服务器。If a large-scale incident in a region results in unavailability of your database application, you can restore a server from the geo-redundant backups to a server in any other region. 异地还原利用服务器的最新备份。Geo-restore utilizes the most recent backup of the server. 提取备份后,会延迟一段时间才会将其复制到其他区域中。There is a delay between when a backup is taken and when it is replicated to different region. 此延迟可能长达一小时,因此发生灾难时,会有长达 1 小时的数据丢失风险。This delay can be up to an hour, so, if a disaster occurs, there can be up to one hour data loss.

在异地还原过程中,可以更改的服务器配置包括计算的代、vCore、备份保持期和备份冗余选项。During geo-restore, the server configurations that can be changed include compute generation, vCore, backup retention period, and backup redundancy options. 不支持在异地还原过程中更改定价层(“基本”、“常规用途”或“内存优化”)或存储大小。Changing pricing tier (Basic, General Purpose, or Memory Optimized) or storage size during geo-restore is not supported.

执行还原后任务Perform post-restore tasks

从任一恢复机制还原后,都应执行以下任务,然后用户和应用程序才能重新运行:After a restore from either recovery mechanism, you should perform the following tasks to get your users and applications back up and running:

  • 如果需要使用新服务器来替换原始服务器,则请将客户端和客户端应用程序重定向到新服务器If the new server is meant to replace the original server, redirect clients and client applications to the new server
  • 对于要进行连接的用户,请确保设置适当的 VNet 规则。Ensure appropriate VNet rules are in place for users to connect. 不会从源服务器复制这些规则。These rules are not copied over from the original server.
  • 确保设置适当的登录名和数据库级权限Ensure appropriate logins and database level permissions are in place
  • 视情况配置警报Configure alerts, as appropriate

后续步骤Next steps