确定 Azure SQL 托管实例所需的子网大小和范围Determine required subnet size & range for Azure SQL Managed Instance

适用于: Azure SQL 托管实例

Azure SQL 托管实例必须部署在 Azure 虚拟网络 (VNet) 中。Azure SQL Managed Instance must be deployed within an Azure virtual network (VNet).

可以在 VNet 子网中部署的托管实例数取决于子网的大小(子网范围)。The number of managed instances that can be deployed in the subnet of a VNet depends on the size of the subnet (subnet range).

创建托管实例时,Azure 会根据预配期间选择的层,分配一定数量的虚拟机。When you create a managed instance, Azure allocates a number of virtual machines depending on the tier you selected during provisioning. 由于这些虚拟机与子网关联,因此它们需要 IP 地址。Because these virtual machines are associated with your subnet, they require IP addresses. 为了确保日常操作和服务维护期间保持高可用性,Azure 可能会分配更多的虚拟机。To ensure high availability during regular operations and service maintenance, Azure may allocate additional virtual machines. 因此,子网中所需的 IP 地址数大于该子网中的托管实例数。As a result, the number of required IP addresses in a subnet is larger than the number of managed instances in that subnet.

根据设计,一个托管实例在一个子网中至少需要 32 个 IP 地址。By design, a managed instance needs a minimum of 32 IP addresses in a subnet. 因此,在定义子网 IP 范围时,可以使用最小的子网掩码,即 /27。As a result, you can use minimum subnet mask of /27 when defining your subnet IP ranges. 建议仔细规划用于部署托管实例的子网大小。Careful planning of subnet size for your managed instance deployments is recommended. 在规划过程中应纳入考虑的输入内容包括:Inputs that should be taken into consideration during planning are:

  • 包含以下实例参数的托管实例的数量:Number of managed instances including following instance parameters:
    • 服务层service tier
    • 硬件代系hardware generation
    • vCore 数目number of vCores
  • 计划纵向扩展/缩减或更改服务层Plans to scale up/down or change service tier

重要

使用具有 16 个 IP 地址(子网掩码 /28)的子网即可部署托管实例,但应仅使用它来部署用于评估的或不执行缩放操作的开发/测试方案中的单个实例。A subnet size with 16 IP addresses (subnet mask /28) will allow deploying managed instance inside it, but it should be used only for deploying single instance used for evaluation or in dev/test scenarios, in which scaling operations will not be performed.

确定子网大小Determine subnet size

根据将来的实例部署和缩放需求调整子网大小。Size your subnet according to the future instance deployment and scaling needs. 可借助以下参数进行计算:Following parameters can help you in forming a calculation:

  • Azure 使用子网中的 5 个 IP 地址来满足自身的需要Azure uses five IP addresses in the subnet for its own needs
  • 每个虚拟群集分配额外数量的地址Each virtual cluster allocates additional number of addresses
  • 每个托管实例使用一定数量的地址,具体取决于定价层和硬件代系Each managed instance uses number of addresses that depends on pricing tier and hardware generation

重要

如果子网中存在任何资源,则无法更改子网地址范围。It is not possible to change the subnet address range if any resource exists in the subnet. 也无法将托管实例从一个子网移动到另一个子网。It is also not possible to move managed instances from one subnet to another. 请尽量考虑使用更大的子网,而不使用较小的子网,以防止将来出现问题。Whenever possible, please consider using bigger subnets rather than smaller to prevent issues in the future.

GP = 常规用途;BC = 业务关键;VC = 虚拟群集GP = general purpose; BC = business critical; VC = virtual cluster

硬件代系Hardware gen 定价层Pricing tier Azure 使用情况Azure usage VC 使用情况VC usage 实例使用情况Instance usage 总计*Total*
Gen4Gen4 GPGP 55 11 55 1111
Gen4Gen4 BCBC 55 11 55 1111
Gen5Gen5 GPGP 55 66 33 1414
Gen5Gen5 BCBC 55 66 55 1616

* 列总数显示在子网中部署一个实例时将采用的地址数。* Column total displays number of addresses that would be taken when one instance is deployed in subnet. 子网中每增加一个实例,都会增加“实例使用情况”列表示的地址数。Each additional instance in subnet adds number of addresses represented with instance usage column. “Azure 使用情况”列表示的地址在多个虚拟群集之间共享,而“VC 使用情况”列表示的地址在该虚拟群集中放置的实例之间共享。Addresses represented with Azure usage column are shared across multiple virtual clusters while addresses represented with VC usage column are shared across instances placed in that virtual cluster.

执行更新操作时,通常需要调整虚拟群集的大小。Update operation typically requires virtual cluster resize. 在某些情况下,执行更新操作需要创建虚拟群集(有关更多详细信息,请参阅管理操作文章)。In some circumstances, update operation will require virtual cluster creation (for more details check management operations article). 如果要创建虚拟群集,所需的额外地址数等于“VC 使用情况”列表示的地址数加上该虚拟群集中放置的实例所需的地址数(“实例使用情况”列)。In case of virtual cluster creation, number of additional addresses required is equal to number of addresses represented by VC usage column summed with addresses required for instances placed in that virtual cluster (instance usage column).

示例 1:你计划使用一个常规用途托管实例(Gen4 硬件)和一个业务关键托管实例(Gen5 硬件)。Example 1: You plan to have one general purpose managed instance (Gen4 hardware) and one business critical managed instance (Gen5 hardware). 这意味着,至少需要 5 + 1 + 1 * 5 + 6 + 1 * 5 = 22 个 IP 地址才能完成部署。That means you need a minimum of 5 + 1 + 1 * 5 + 6 + 1 * 5 = 22 IP addresses to be able to deploy. 由于 IP 范围定义为 2 的 N 次方,因此子网要求该部署的最小 IP 范围为 32 (2^5) 个地址。As IP ranges are defined in power of 2, your subnet requires minimum IP range of 32 (2^5) for this deployment.

如上所述,在某些情况下,执行更新操作需要创建虚拟群集。As mentioned above, in some circumstances, update operation will require virtual cluster creation. 这意味着,这里举个例子,如果要更新到需要创建虚拟群集的 Gen5 业务关键托管实例,就需要额外的 6 + 5 = 11 个可用 IP 地址。This means that, as an example, in case of an update to the Gen5 business critical managed instance that requires a virtual cluster creation, you will need to have additional 6 + 5 = 11 IP addresses available. 由于已经使用了 22 个地址(共 32 个地址),没有足够的可用地址可用来实现此操作。Since you are already using 22 of the 32 addresses, there is no available addresses for this operation. 因此,需要保留子网掩码为 /26(64 个地址)的子网。Therefore, you need to reserve the subnet with subnet mask of /26 (64 addresses).

示例 2:你计划将三个常规用途(Gen5 硬件)和两个业务关键托管实例(Gen5 硬件)置于同一子网中。Example 2: You plan to have three general purpose (Gen5 hardware) and two business critical managed instances (Gen5 hardware) placed in same subnet. 这意味着,你需要 5 + 6 + 3 * 3 + 2 * 5 = 30 个 IP 地址。That means you need 5 + 6 + 3 * 3 + 2 * 5 = 30 IP addresses. 因此,你需要保留子网掩码为 /26 的子网。Therefore, you need to reserve the subnet with subnet mask of /26. 选择子网掩码 /27 将导致剩余地址数量为 2 (32 � 30),这将阻止所有实例的更新操作,因为子网中需要额外的地址才能执行实例缩放。Selecting a subnet mask of /27 would cause the remaining number of addresses to be 2 (32 � 30), this would prevent update operations for all instances as additional addresses are required in subnet for performing instance scaling.

示例 3:你计划使用一个常规用途托管实例(Gen5 硬件),并不时执行 vCores 更新操作。Example 3: You plan to have one general purpose managed instance (Gen5 hardware) and perform vCores update operation from time to time. 这意味着,你需要 5 + 6 + 1 * 3 + 3 = 17 个 IP 地址。That means you need 5 + 6 + 1 * 3 + 3 = 17 IP addresses. 由于 IP 范围定义为 2 的 N 次方,因此需要 32 个 (2^5) IP 地址。As IP ranges are defined in power of 2, you need the IP range of 32 (2^5) IP addresses. 因此,需要保留子网掩码为 /27 的子网。Therefore, you need to reserve the subnet with subnet mask of /27.

“更新”方案的地址要求Address requirements for update scenarios

在缩放期间,实例临时需要额外的 IP 容量,该容量具体取决于定价层和硬件代系During scaling operation instances temporarily require additional IP capacity that depends on pricing tier and hardware generation

硬件代系Hardware gen 定价层Pricing tier 方案Scenario 更多地址*Additional addresses*
Gen4Gen4 GP 或 BCGP or BC 缩放 Vcore 数目Scaling vCores 55
Gen4Gen4 GP 或 BCGP or BC 缩放存储Scaling storage 55
Gen4Gen4 GP 或 BCGP or BC 从 GP 切换到 BC 或从 BC 切换到 GPSwitching from GP to BC or BC to GP 55
Gen4Gen4 GPGP 正在切换到 Gen5*Switching to Gen5* 99
Gen4Gen4 BCBC 正在切换到 Gen5*Switching to Gen5* 1111
Gen5Gen5 GPGP 缩放 Vcore 数目Scaling vCores 33
Gen5Gen5 GPGP 缩放存储Scaling storage 00
Gen5Gen5 GPGP 正在切换到 BCSwitching to BC 55
Gen5Gen5 BCBC 缩放 Vcore 数目Scaling vCores 55
Gen5Gen5 BCBC 缩放存储Scaling storage 55
Gen5Gen5 BCBC 正在切换到 GPSwitching to GP 33

* Gen4 硬件正在逐步被淘汰,不能再用于新部署。* Gen4 hardware is being phased out and is no longer available for new deployments. 将硬件代系从 Gen4 更新为 Gen5,以利用特定于 Gen5 硬件代系的功能。Update hardware generation from Gen4 to Gen5 to take advantage of the capabilities specific to Gen5 hardware generation.

后续步骤Next steps