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

将虚拟网络(经典)从地缘组迁移到区域Migrate a virtual network (classic) from an affinity group to a region

重要

Azure 具有用于创建和处理资源的两个不同的部署模型: Resource Manager 和经典Azure has two different deployment models for creating and working with resources: Resource Manager and classic. 本文介绍使用经典部署模型。This article covers using the classic deployment model. Microsoft 建议大多数新部署使用 Resource Manager 部署模型。Microsoft recommends that most new deployments use the Resource Manager deployment model.

地缘组确保在相同地缘组中创建的资源由彼此靠近的服务器实际托管,从而加快这些资源的通信速度。Affinity groups ensure that resources created within the same affinity group are physically hosted by servers that are close together, enabling these resources to communicate quicker. 过去,地缘组是创建虚拟网络(经典)的必要条件。In the past, affinity groups were a requirement for creating virtual networks (classic). 当时,托管虚拟网络(经典)的网络管理器服务只能在一组物理服务器或缩放单位内工作。At that time, the network manager service that managed virtual networks (classic) could only work within a set of physical servers or scale unit. 体系结构改进已将网络管理的范畴扩大到了区域。Architectural improvements have increased the scope of network management to a region.

由于这些体系结构的改进,不再建议或需要对虚拟网络(经典)使用地缘组。As a result of these architectural improvements, affinity groups are no longer recommended, or required for virtual networks (classic). 现在,对虚拟网络(经典)使用地缘组的做法已被区域取代。The use of affinity groups for virtual networks (classic) is replaced by regions. 与区域关联的虚拟网络(经典)称为区域虚拟网络。Virtual networks (classic) that are associated with regions are called regional virtual networks.

我们建议在一般情况下不要使用地缘组。We recommend that you don't use affinity groups in general. 除了虚拟网络要求外,使用地缘组来确保计算(经典)和存储(经典)等资源的位置相互靠近同样重要。Aside from the virtual network requirement, affinity groups were also important to use to ensure resources, such as compute (classic) and storage (classic), were placed near each other. 但是,对于当前的 Azure 网络体系结构,不再需要满足这些位置要求。However, with the current Azure network architecture, these placement requirements are no longer necessary.

重要

尽管从技术上讲仍可以创建与地缘组关联的虚拟网络,但是,没有令人信服的理由让人这么做。Although it is still technically possible to create a virtual network that is associated with an affinity group, there is no compelling reason to do so. 许多虚拟网络功能,例如网络安全组,仅当使用区域虚拟网络时才可用,而不能用于与地缘组关联的虚拟网络。Many virtual network features, such as network security groups, are only available when using a regional virtual network, and are not available for virtual networks that are associated with affinity groups.

编辑网络配置文件Edit the network configuration file

  1. 导出网络配置文件。Export the network configuration file. 若要了解如何使用 PowerShell 或 Azure 命令行接口 (CLI) 1.0 导出网络配置文件,请参阅使用网络配置文件配置虚拟网络To learn how to export a network configuration file using PowerShell or the Azure command-line interface (CLI) 1.0, see Configure a virtual network using a network configuration file.
  2. 编辑网络配置文件,并将 AffinityGroup 替换为 LocationEdit the network configuration file, replacing AffinityGroup with Location. Location 指定一个 Azure 区域You specify an Azure region for Location.

    备注

    Location 是已为与虚拟网络(经典)关联的地缘组指定的区域。The Location is the region that you specified for the affinity group that is associated with your virtual network (classic). 例如,如果虚拟网络(经典)与位于美国西部的地缘组关联,则在迁移时,Location 必须指向美国西部。For example, if your virtual network (classic) is associated with an affinity group that is located in West US, when you migrate, your Location must point to West US.

    编辑网络配置文件中的以下行,将相应值替换成自己的值:Edit the following lines in your network configuration file, replacing the values with your own:

    旧值: <VirtualNetworkSitename="VNetUSWest" AffinityGroup="VNetDemoAG">Old value: <VirtualNetworkSitename="VNetUSWest" AffinityGroup="VNetDemoAG">

    新值: <VirtualNetworkSitename="VNetUSWest" Location="West US">New value: <VirtualNetworkSitename="VNetUSWest" Location="West US">

  3. 保存所做的更改,并将网络配置导入到 Azure。Save your changes and import the network configuration to Azure.

备注

此迁移不会导致服务出现任何停机情况。This migration does NOT cause any downtime to your services.

如果在地缘组中有一个 VM(经典)该怎么办What to do if you have a VM (classic) in an affinity group

当前位于地缘组中的 VM(经典)不需要从地缘组中删除。VMs (classic) that are currently in an affinity group do not need to be removed from the affinity group. 在 VM 部署后,系统会将其部署到单个缩放单位。Once a VM is deployed, it is deployed to a single scale unit. 地缘组可以限制可用于新 VM 部署的 VM 大小集,但是部署的任何现有 VM 已限制为在其中部署该 VM 的缩放单位中可用的 VM 大小集。Affinity groups can restrict the set of available VM sizes for a new VM deployment, but any existing VM that is deployed is already restricted to the set of VM sizes available in the scale unit in which the VM is deployed. 由于该 VM 已部署到缩放单位,因此,从地缘组中删除该 VM 不会对 VM 产生影响。Because the VM is already deployed to a scale unit, removing a VM from an affinity group has no effect on the VM.