Azure VM 上的 SQL Server 的 Always On 可用性组Always On availability group on SQL Server on Azure VMs

适用于: Azure VM 上的 SQL Server

本文介绍 Azure 虚拟机 (VM) 上 SQL Server 的 Always On 可用性组。This article introduces Always On availability groups for SQL Server on Azure Virtual Machines (VMs).

概述Overview

Azure 虚拟机上的 Always On 可用性组类似于本地的 Always On 可用性组Always On availability groups on Azure Virtual Machines are similar to Always On availability groups on-premises. 但是,由于虚拟机托管在 Azure 中,还存在其他一些注意事项,例如 VM 冗余以及 Azure 网络上的流量路由。However, since the virtual machines are hosted in Azure, there are a few additional considerations as well, such as VM redundancy, and routing traffic on the Azure network.

下图演示了 Azure VM 上的 SQL Server 可用性组:The following diagram illustrates an availability group for SQL Server on Azure VMs:

可用性组

VM 冗余VM redundancy

若要提高冗余和可用性,SQL Server VM 应位于相同的可用性集中。To increase redundancy and high availability, the SQL Server VMs should be in the same availability set.

这可防止在部署推出期间影响组中的多个资源。This prevents impacting multiple resources in the group during deployment roll outs.

连接Connectivity

在传统的本地部署中,客户端使用虚拟网络名称 (VNN) 连接到可用性组侦听器,该侦听器将流量路由到可用性组中相应的 SQL Server 副本。In a traditional on-premises deployment, clients connect to the availability group listener using the virtual network name (VNN), and the listener routes traffic to the appropriate SQL Server replica in the availability group. 但是,在 Azure 网络上路由流量需满足其他要求。However, there is an extra requirement to route traffic on the Azure network.

通过 Azure VM 上的 SQL Server,配置一个负载均衡器来将流量路由到可用性组侦听器。如果你在使用 SQL Server 2019 CU8 及更高版本,可配置一个分布式网络名称 (DNN) 侦听器来取代传统的 VNN 可用性组侦听器。With SQL Server on Azure VMs, configure a load balancer to route traffic to your availability group listener, or, if you're on SQL Server 2019 CU8 and later, you can configure a distributed network name (DNN) listener to replace the traditional VNN availability group listener.

VNN 侦听器VNN listener

使用 Azure 负载均衡器将流量从侦听器路由到 Azure 网络上的传统可用性组虚拟网络名称 (VNN) 侦听器。Use an Azure Load Balancer to route traffic from the client to the traditional availability group virtual network name (VNN) listener on the Azure network.

负载均衡器保留 VNN 侦听器的 IP 地址。The load balancer holds the IP addresses for the VNN listener. 如果有多个可用性组,则每个组都需要一个 VNN 侦听器。If you have more than one availability group, each group requires a VNN listener. 一个负载均衡器可以支持多个侦听器。One load balancer can support multiple listeners.

若要开始,请参阅配置负载均衡器To get started, see configure a load balancer.

DNN 侦听器DNN listener

SQL Server 2019 CU8 引入了对分布式网络名称 (DNN) 侦听器的支持。SQL Server 2019 CU8 introduces support for the distributed network name (DNN) listener. DNN 侦听器取代了传统的可用性组侦听器,消除了使用 Azure 负载均衡器在 Azure 网络上路由流量的需求。The DNN listener replaces the traditional availability group listener, negating the need for an Azure Loud Balancer to route traffic on the Azure network.

DNN 侦听器是 Azure 中推荐的 HADR 连接解决方案,它可简化部署、减少维护量和成本,同时减少在出现故障时进行故障转移的时间。The DNN listener is the recommended HADR connectivity solution in Azure as it simplifies deployment, reduces maintenance and cost, and reduces failover time in the event of a failure.

请使用 DNN 侦听器来替代现有的 VNN 侦听器,或者将它与现有的 VNN 侦听器一起使用,使你的可用性组有两个不同的连接点 - 一个使用 VNN 侦听器名称(如果非默认,则还使用 VNN 侦听器端口),而另一个使用 DNN 侦听器名称和端口。Use the DNN listener to replace an existing VNN listener, or alternatively, use it in conjunction with an existing VNN listener so that your availability group has two distinct connection points - one using the VNN listener name (and port if non-default), and one using the DNN listener name and port. 如果客户想要避免负载均衡器故障转移延迟,但仍使用依赖于 VNN 侦听器的 SQL Server 功能,例如分布式可用性组、服务代理或文件流,则这非常有用。This could be useful for customers who want to avoid the load balancer failover latency but still take advantage of SQL Server features that depend on the VNN listener, such as distributed availability groups, service broker or filestream. 若要了解详细信息,请参阅 DNN 侦听器和 SQL Server 功能互操作性To learn more, see DNN listener and SQL Server feature interoperability

若要开始,请参阅配置DNN 侦听器To get started, see configure a DNN listener.

注意事项Considerations

在 Azure IaaS VM 来宾故障转移群集上,建议为每个服务器(群集节点)设置一个 NIC,并且只使用一个子网。On an Azure IaaS VM guest failover cluster, we recommend a single NIC per server (cluster node) and a single subnet. Azure 网络具有物理冗余,这使得在 Azure IaaS VM 来宾群集上不需要额外的 NIC 和子网。Azure networking has physical redundancy, which makes additional NICs and subnets unnecessary on an Azure IaaS VM guest cluster. 虽然群集验证报告将发出警告,指出节点只能在单个网络上访问,但在 Azure IaaS VM 来宾故障转移群集上可以安全地忽略此警告。Although the cluster validation report will issue a warning that the nodes are only reachable on a single network, this warning can be safely ignored on Azure IaaS VM guest failover clusters.

后续步骤Next steps

查看 HADR 最佳做法,然后开始手动部署可用性组。Review the HADR best practices and then get started with deploying your availability group manually.

或者,可部署无群集的可用性组或者多个区域中的可用性组。Alternatively, you can deploy a clusterless availability group or an availability group in multiple regions.