您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

将 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://westcentralus.asazure.windows.net/advworks01For example, asazure://westcentralus.asazure.windows.net/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. 选择 " 存储资源管理器",然后展开 " BLOB 容器"。Select Storage Explorer, and then expand BLOB CONTAINERS.

  3. 右键单击存储容器,然后选择 " 获取共享访问签名"。Right-click your storage container, and then select Get Shared Access Signature.

    获取 SAS

  4. 在 " 共享访问签名" 中,选择 " 创建"。In Shared Access Signature, select Create. 默认情况下,SAS 将在24小时后过期。By default, the SAS will expire in 24 hours.

  5. 复制并保存 URICopy and save the URI.

修改模板Modify the template

使用文本编辑器修改所导出文件的 template.js,并更改区域和 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. 在文本编辑器的 " 位置 " 属性中,指定新的目标区域。In a text editor, in the location property, specify the new target region. backupBlobContainerUri 属性中,粘贴存储容器 URI 和 SAS 密钥。In the backupBlobContainerUri property, paste the storage container Uri with SAS key.

    下面的示例将服务器 advworks1 的目标区域设置为 South Central US ,并使用共享访问签名指定存储容器 Uri:The following example sets the target region for server advworks1 to South Central US 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": "South Central US",
            "sku": {
                "name": "S1",
                "tier": "Standard",
                "capacity": 1
            },
            "properties": {
                "asAdministrators": {
                    "members": [
                        "asadmins@adventure-works.com"
                    ]
                },
                "backupBlobContainerUri": "https://storagenorthcentralus.blob.core.windows.net/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 获取区域,请运行 AzLocation 命令。To get regions by using PowerShell, run the Get-AzLocation command.

   Get-AzLocation | format-table 

移动Move

若要在不同的区域中部署新的服务器资源,你将使用之前部分中导出和修改的文件的 template.jsTo 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.jsSelect 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. 选择“查看并创建”。Select Review and Create.

  11. 查看条款和基础知识,然后选择 " 创建"。Review the terms and Basics, and then select Create.

获取目标服务器 UriGet target server Uri

若要从 SSMS 连接到新的目标服务器以还原 model 数据库,需要获取新的目标服务器 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

按照 restore 中所述的步骤将 model .abf 备份还原到新的目标服务器。Follow steps described in Restore to restore the model database .abf backup to the new target server.

可选:在还原 model 数据库后,处理模型和表以刷新数据源中的数据。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. 在 " 进程" 表中 (s),选择 "所有表",然后选择 "确定"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.