备份 Azure Stack Hub 上的应用服务Back up App Service on Azure Stack Hub

本文档说明如何备份 Azure Stack Hub 上的应用服务。This document provides instructions on how to back up App Service on Azure Stack Hub.

重要

Azure Stack Hub 上的应用服务不会作为 Azure Stack Hub 基础结构备份的一部分进行备份。App Service on Azure Stack Hub isn't backed up as part of Azure Stack Hub infrastructure backup. 在必要的情况下,Azure Stack Hub 操作员必须执行相应的步骤来确保应用服务可成功恢复。As an Azure Stack Hub Operator, you must take steps to ensure App Service can be successfully recovered if necessary.

规划灾难恢复时,需要考虑到 Azure Stack Hub 上的 Azure 应用服务的四个主要组件:Azure App Service on Azure Stack Hub has four main components to consider when planning for disaster recovery:

  1. 资源提供程序基础结构、服务器角色、辅助角色层等。The resource provider infrastructure; server roles, worker tiers, and so on.
  2. 应用服务机密。The App Service secrets.
  3. 应用服务SQL Server 托管和计量数据库。The App Service SQL Server hosting and metering databases.
  4. 应用服务文件共享中存储的应用服务用户工作负荷内容。The App Service user workload content stored in the App Service file share.

备份应用服务机密Back up App Service secrets

从备份恢复应用服务时,需要提供初始部署所用的应用服务密钥。When recovering App Service from backup, you need to provide the App Service keys used by the initial deployment. 成功部署应用服务并将其存储在安全位置后,应立即保存此信息。This information should be saved as soon as App Service is successfully deployed and stored in a safe location. 在使用应用服务恢复 PowerShell cmdlet 进行恢复期间,将从备份重新创建资源提供程序基础结构配置。The resource provider infrastructure configuration is recreated from backup during recovery using App Service recovery PowerShell cmdlets.

请遵循以下步骤,使用管理门户备份应用服务机密:Use the administration portal to back up app service secrets by following these steps:

  1. 以服务管理员身份登录到 Azure Stack Hub 管理员门户。Sign in to the Azure Stack Hub administrator portal as the service admin.

  2. 浏览到“应用服务” -> “机密”。 Browse to App Service -> Secrets.

  3. 选择“下载机密”。 Select Download Secrets.

    在 Azure Stack Hub 管理员门户中下载机密

  4. 准备好下载机密时,单击“保存”,并将应用服务机密 (SystemSecrets.JSON) 文件存储到安全位置。When secrets are ready for downloading, click Save and store the App Service secrets (SystemSecrets.JSON) file in a safe location.

    在 Azure Stack Hub 管理员门户中保存机密

备注

每次轮换应用服务机密时都需要重复这些步骤。Repeat these steps every time the App Service secrets are rotated.

备份应用服务数据库Back up the App Service databases

若要还原应用服务,需要 Appservice_hostingAppservice_metering 数据库备份。To restore App Service, you need the Appservice_hosting and Appservice_metering database backups. 我们建议使用 SQL Server 维护计划或 Azure 备份服务器来确保定期安全备份和保存这些数据库。We recommend using SQL Server maintenance plans or Azure Backup Server to ensure these databases are backed up and saved securely on a regular basis. 但是,可以使用任何可确保创建例行 SQL 备份的方法。However, any method of ensuring regular SQL backups are created can be used.

若要在登录到 SQL Server 时手动备份这些数据库,请使用以下 PowerShell 命令:To manually back up these databases while logged into the SQL Server, use the following PowerShell commands:

$s = "<SQL Server computer name>"
$u = "<SQL Server login>" 
$p = read-host "Provide the SQL admin password"
sqlcmd -S $s -U $u -P $p -Q "BACKUP DATABASE appservice_hosting TO DISK = '<path>\hosting.bak'"
sqlcmd -S $s -U $u -P $p -Q "BACKUP DATABASE appservice_metering TO DISK = '<path>\metering.bak'"

备注

如果需要备份 SQL AlwaysOn 数据库,请遵照这些说明操作。If you need to back up SQL AlwaysOn databases, follow these instructions.

成功备份所有数据库之后,请将 .bak 文件连同应用服务机密信息一起复制到安全位置。After all databases have been successfully backed up, copy the .bak files to a safe location along with the App Service secrets info.

备份应用服务文件共享Back up the App Service file share

应用服务将租户应用信息存储在文件共享中。App Service stores tenant app info in the file share. 必须定期将此文件共享连同应用服务数据库一起备份,以便在需要还原时尽量减少丢失的数据量。This file share must be backed up on a regular basis along with the App Service databases so that as little data as possible is lost if a restore is required.

若要备份应用服务文件共享内容,请使用 Azure 备份服务器或其他方法,定期将文件共享内容复制到保存所有以前恢复信息的位置。To back up the App Service file share content, use Azure Backup Server or another method to regularly copy the file share content to the location you've saved all previous recovery info.

例如,可以按照这些步骤从 Windows PowerShell(不是 PowerShell ISE)控制台会话使用 Robocopy:For example, you can use these steps to use Robocopy from a Windows PowerShell (not PowerShell ISE) console session:

$source = "<file share location>"
$destination = "<remote backup storage share location>"
net use $destination /user:<account to use to connect to the remote share in the format of domain\username> *
robocopy $source $destination
net use $destination /delete

后续步骤Next steps

还原 Azure Stack Hub 上的应用服务Restore App Service on Azure Stack Hub