将 Analysis Services 移动到其他区域Move Analysis Services to a different region

本文介绍了如何将 Analysis Services 服务器资源移动到其他 Azure 区域。This article describes how to move an Analysis Services server resource to a different Azure region. 你可能希望将服务器移动到其他区域,原因有许多,例如:利用更靠近用户的 Azure 区域、使用仅在特定区域中受支持的服务计划,或者满足内部策略和治理要求。You might move your server to another region for a number of reasons, for example, to take advantage of an Azure region closer to users, to use service plans supported in specific regions only, or to meet internal policy and governance requirements.

在此文章和关联的链接文章中,你将了解如何执行以下操作:In this and associated linked articles, you learn how to:

  • 将源服务器模型数据库备份到 Blob 存储Backup a source server model database to Blob storage.
  • 导出源服务器资源模板Export a source server resource template.
  • 获取存储共享访问签名 (SAS)Get a storage shared access signature (SAS).
  • 修改资源模板。Modify the resource template.
  • 部署模板来创建新的目标服务器。Deploy the template to create a new target server.
  • 将模型数据库还原到新的目标服务器。Restore a model database to the new target server.
  • 验证新的目标服务器和数据库。Verify the new target server and database.
  • 删除源服务器。Delete the source server.

本文介绍了如何通过资源模板将使用“基本配置”的单个 Analysis Services 服务器迁移到同一订阅中的其他区域和资源组。This article describes using a resource template to migrate a single Analysis Services server with a basic configuration to a different region and resource group in the same subscription. 使用模板会保留已配置的服务器属性,确保为目标服务器配置与源服务器相同的属性(区域和资源组除外)。Using a template retains configured server properties ensuring the target server is configured with the same properties, except region and resource group, as the source server. 本文没有介绍如何移动可能属于相同资源组的关联资源,例如数据源、存储和网关资源。This article does not describe moving associated resources that may be part of the same resource group such as data source, storage, and gateway resources.

在将服务器移动到其他区域之前,建议你创建一个详细的计划。Before moving a server to a different region, it's recommended you create a detailed plan. 考虑其他也可能需要移动的资源,例如网关和存储。Consider additional resources such as gateways and storage that may also need to be moved. 对于任何计划,在移动生产服务器之前,请务必使用测试服务器完成一个或多个试验性移动操作。With any plan, it's important to complete one or more trial move operations using test servers prior to moving a production server.

重要

客户端应用程序和连接字符串使用完整服务器名称(一个 URI,其中包含服务器所在的区域)连接到 Analysis Services。Client applications and connection strings connect to Analysis Services by using the full server name, which is a Uri that includes the region the server is in. 例如,asazure://chinanorth.asazure.chinacloudapi.cn/advworks01For example, asazure://chinanorth.asazure.chinacloudapi.cn/advworks01. 将服务器移动到其他区域时,实际上会在其他区域中创建一个新的服务器资源,该资源在服务器名称 URI 中会有一个不同的区域。When moving a server to a different region, you are effectively creating a new server resource in a different region, which will have a different region in the server name Uri. 客户端应用程序和连接字符串(在脚本中使用)必须使用新的服务器名称 URI 连接到新服务器。Client applications and connection strings used in scripts must connect to the new server using the new server name Uri. 使用服务器别名可以减少必须更改服务器名称 URI 的位置数量,但这必须在进行区域移动之前实施。Using a Server name alias can mitigate the number of places the server name Uri has to be changed, but must be implemented prior to a region move.

重要

Azure 区域使用不同的 IP 地址范围。Azure regions use different IP address ranges. 如果你为服务器和/或存储帐户所在的区域配置了防火墙例外,则可能需要配置一个不同的 IP 地址范围。If you have firewall exceptions configured for the region your server and/or storage account is in, it may be necessary to configure a different IP address range. 若要了解详细信息,请参阅有关 Analysis Services 网络连接的常见问题解答To learn more, see Frequently asked questions about Analysis Services network connectivity.

备注

本文介绍了如何将数据库备份从源服务器所在区域中的存储容器还原到目标服务器。This article describes restoring a database backup to a target server from a storage container in the source server's region. 在某些情况下,从不同的区域还原备份的性能可能较低,尤其是对于大型数据库而言。In some cases, restoring backups from a different region can have poor performance, especially for large databases. 要想在数据库还原期间获得最佳性能,请进行迁移,或者在目标服务器区域中创建一个新的存储容器。For the best performance during database restore, migrate or create a a new storage container in the target server region. 将数据库还原到目标服务器之前,请将 .abf 备份文件从源区域存储容器复制到目标区域存储容器。Copy the .abf backup files from the source region storage container to the target region storage container prior to restoring the database to the target server. 在某些情况下(特别是在使用超大数据库的情况下),从源服务器编写数据库脚本,重新创建数据库,然后在目标服务器上进行处理以加载数据库数据可能比使用备份/还原更为经济高效。当然,这超出了本文的讨论范围。While out of scope for this article, in some cases, particularly with very large databases, scripting out a database from your source server, recreating, and then processing on the target server to load database data may be more cost effective than using backup/restore.

备注

如果使用本地数据网关连接到数据源,则还必须将网关资源移动到目标服务器区域。If using an On-premises data gateway to connect to data sources, you must also move the gateway resource to the target server region. 若要了解详细信息,请参阅安装并配置本地数据网关To learn more, see Install and configure an on-premises data gateway.

先决条件Prerequisites

  • Azure 存储帐户:需要使用它来存储 .abf 备份文件。Azure storage account: Required to store an .abf backup file.
  • SQL Server Management Studio (SSMS):需要使用它来备份和还原模型数据库。SQL Server Management Studio (SSMS): Required to backup and restore model databases.
  • Azure PowerShellAzure PowerShell. 仅当你选择使用 PowerShell 来完成此任务时,才需要使用它。Required only if you choose to complete this task by using PowerShell.

准备Prepare

备份模型数据库Backup model databases

如果尚未为源服务器配置“存储设置”,请按照配置存储设置中的步骤进行操作。If Storage settings are not already configured for the source server, follow the steps in Configure storage settings.

配置存储设置后,请按照备份中的步骤在存储容器中创建模型数据库 .abf 备份。When storage settings are configured, follow the steps in Backup to create a model database .abf backup in your storage container. 稍后需要将 .abf 备份还原到新的目标服务器。You later restore the .abf backup to your new target server.

导出模板Export template

模板包含源服务器的配置属性。The template contains configuration properties of the source server.

若要使用 Azure 门户导出模板:To export a template by using Azure portal:

  1. 登录到 Azure 门户Sign in to the Azure portal.

  2. 选择“所有资源”,然后选择你的 Analysis Services 服务器。Select All resources, and then select your Analysis Services server.

  3. 选择“设置” > “导出模板”。 Select > Settings > Export template.

  4. 选择“导出模板”边栏选项卡中的“下载”。 Choose Download in the Export template blade.

  5. 找到从门户下载的 .zip 文件,然后将该文件解压缩到一个文件夹。Locate the .zip file that you downloaded from the portal, and then unzip that file to a folder.

    该 zip 文件包含构成模板的 .json 文件以及部署新服务器所需的参数。The zip file contains the .json files that comprise the template and parameters necessary to deploy a new server.

获取存储共享访问签名 (SAS)Get storage shared access signature (SAS)

通过模板部署目标服务器时,需要使用用户委托 SAS 令牌(作为 URI)来指定包含数据库备份的存储容器。When deploying a target server from a template, a user delegation SAS token (as a Uri) is required to specify the storage container containing the database backup.

若要使用门户获取共享访问签名,请执行以下操作:To get a shared access signature by using the portal:

  1. 在门户中,选择用于备份你的服务器数据库的存储帐户。In the portal, select the storage account used to backup your server database.

  2. 选择“共享访问签名”,然后在“允许的服务”中选择 Container,在“允许的资源类型”中选择 BlobSelect Shared access signature, and then select Blob in Allowed service and Container in Allowed resource types.

  3. 选择“生成 SAS 和连接字符串”。Select Generate SAS and connection string.

    获取 SAS

  4. 复制并保存“Blob 服务 SAS URL”。Copy and save the Blob service SAS URL. 默认情况下,SAS 会在 24 小时后过期。By default, the SAS will expire in 24 hours.

修改模板Modify the template

使用文本编辑器修改你导出的 template.json 文件,并更改区域和 blob 容器属性。Use a text editor to modify the template.json file you exported, changing the region and blob container properties.

若要修改模板,请执行以下操作:To modify the template:

  1. 在文本编辑器中,在“location”属性中指定新的目标区域。In a text editor, in the location property, specify the new target region. 在“backupBlobContainerUri”属性中,粘贴包含 SAS 密钥的存储容器 URI。In the backupBlobContainerUri property, paste the storage container Uri with SAS key.

    以下示例将服务器 advworks1 的目标区域设置为 China East 2,并指定包含共享访问签名的存储容器 URI:The following example sets the target region for server advworks1 to China East 2 and specifies the storage container Uri with shared access signature:

    "resources": [
        {
            "type": "Microsoft.AnalysisServices/servers",
            "apiVersion": "2017-08-01",
            "name": "[parameters('servers_advworks1_name')]",
            "location": "chinaeast2",
            "sku": {
                "name": "S1",
                "tier": "Standard",
                "capacity": 1
            },
            "properties": {
                "asAdministrators": {
                    "members": [
                        "asadmins@adventure-works.com"
                    ]
                },
                "backupBlobContainerUri": "https://storagechinanorth.blob.core.chinacloudapi.cn/backup?sp=rl&st=2020-06-01T19:30:42Z&se=2020-06-02T19:30:42Z&sv=2019-10-10&sr=c&sig=PCQ4s9RujJkxu89gO4tiDTbE3%2BFECx6zAdcv8x0cVUQ%3D",
                "querypoolConnectionMode": "All"
            }
        }
    ]         
    
  2. 保存模板。Save the template.

区域Regions

若要获取 Azure 区域,请参阅 Azure 位置To get Azure regions, see Azure locations. 若要使用 PowerShell 获取区域,请运行 Get-AzLocation 命令。To get regions by using PowerShell, run the Get-AzLocation command.

   Get-AzLocation | format-table 

移动Move

若要在其他区域中部署新的服务器资源,需使用在前面的部分导出并修改的 template.json 文件。To deploy a new server resource in a different region, you'll use the template.json file you exported and modified in the previous sections.

  1. 在门户中,选择“创建资源”。In the portal, select Create a resource.

  2. 在“搜索市场”中键入“模板部署”,然后按 ENTERIn Search the Marketplace, type template deployment, and then press ENTER.

  3. 选择“模板部署”。Select Template deployment.

  4. 选择“创建” 。Select Create.

  5. 选择“在编辑器中生成自己的模板”。Select Build your own template in the editor.

  6. 选择“加载文件”,然后按说明加载你导出并修改的 template.json 文件。Select Load file, and then follow the instructions to load the template.json file you exported and modified.

  7. 验证模板编辑器是否显示了你的新目标服务器的正确属性。Verify the template editor shows the correct properties for your new target server.

  8. 选择“保存” 。Select Save.

  9. 输入或选择属性值:Enter or select the property values:

    • 订阅:选择 Azure 订阅。Subscription: Select the Azure subscription.

    • 资源组:选择“新建”并输入资源组名称。Resource group: Select Create new, and then enter a resource group name. 如果某个现有资源组尚未包含同名的 Analysis Services 服务器,则可以选择该资源组。You can select an existing resource group provided it does not already contain an Analysis Services server with the same name.

    • 位置:选择你在模板中指定的同一区域。Location: Select the same region you specified in the template.

  10. 查看条款和基本信息,选择“我同意上述条款和条件”,然后选择“购买”。Review the terms and Basics, select I agree to the terms and conditions stated above, and then select Purchase.

获取目标服务器 URIGet target server Uri

若要从 SSMS 连接到新的目标服务器来还原模型数据库,需要获取新的目标服务器 URI。In order to connect to the new target server from SSMS to restore the model database, you need to get the new target server Uri.

若要在门户中获取服务器 URI,请执行以下操作:To get the server Uri in the portal:

  1. 在门户中,转到新的目标服务器资源。In the portal, go to the new target server resource.

  2. 在“概述”页上,复制“服务器名称”URI 。On the Overview page, copy the Server name Uri.

还原模型数据库Restore model database

按照还原中介绍的步骤将模型数据库 .abf 备份还原到新的目标服务器。Follow steps described in Restore to restore the model database .abf backup to the new target server.

可选:还原模型数据库后,处理模型和表以从数据源刷新数据。Optional: After restoring the model database, process the model and tables to refresh data from data sources. 若要使用 SSMS 处理模型和表,请执行以下操作:To process the model and table by using SSMS:

  1. 在 SSMS 中,右键单击模型数据库 >“处理数据库”。In SSMS, right-click the model database > Process Database.

  2. 展开“表”,右键单击某个表。Expand Tables, right-click a table. 在“处理表”中,选择所有表,然后选择“确定”。In Process Table(s), select all tables, and then select OK.

验证Verify

  1. 在门户中,转到新的目标服务器。In the portal, go to the new target server.

  2. 在“概述”页的“Analysis Services 服务器上的模型”中,验证是否显示了还原的模型。On the Overview page, in Models on Analysis Services server, verify restored models appear.

  3. 使用 Power BI 或 Excel 之类的客户端应用程序连接到新服务器上的模型。Use a client application like Power BI or Excel to connect to the model on the new server. 验证是否显示了模型对象,例如表、度量值和层次结构。Verify model objects such as tables, measures, hierarchies appear.

  4. 运行任何自动化脚本。Run any automation scripts. 验证它们是否已成功执行。Verify they executed successfully.

可选:ALM 工具包是一个开源工具,用于比较和管理 Power BI 数据集和 Analysis Services 表格模型数据库。Optional: ALM Toolkit is an open source tool for comparing and managing Power BI Datasets and Analysis Services tabular model databases. 使用工具包连接到源服务器和目标服务器数据库,并进行比较。Use the toolkit to connect to both source and target server databases and compare. 如果数据库迁移成功,则模型对象会具有相同的定义。If your database migration is successful, model objects will the same definition.

ALM 工具包

清理资源Clean up resources

在验证客户端应用程序可以连接到新服务器且任何自动化脚本都在正确执行之后,请删除源服务器。After verifying client applications can connect to the new server and any automation scripts are executing correctly, delete your source server.

若要从门户中删除源服务器,请执行以下操作:To delete the source server from the portal:

在源服务器的“概述”页面上,选择“删除”。In your source server's Overview page, select Delete.

备注

完成区域移动后,建议让新的目标服务器使用同一区域中的存储容器进行备份,而不是使用源服务器区域中的存储容器。After completing a region move, it's recommended your new target server use a storage container in the same region for backups, rather than the storage container in the source server region.