与 AG 和 DNN 侦听器的功能互操作性Feature interoperability with AG and DNN listener

适用于: Azure VM 上的 SQL Server

某些 SQL Server 功能依赖于硬编码的虚拟网络名称 (VNN)。There are certain SQL Server features that rely on a hard-coded virtual network name (VNN). 因此,在 Azure VM 上将分布式网络名称 (DNN) 侦听器与 Always On 可用性组和 SQL Server 一起使用时,可能还有一些额外的注意事项。As such, when using the distributed network name (DNN) listener with your Always On availability group and SQL Server on Azure VMs, there may be some additional considerations.

本文详细介绍了 SQL Server 功能以及与可用性组 DNN 侦听器的互操作性。This article details SQL Server features and interoperability with the availability group DNN listener.

客户端驱动程序Client drivers

对于 ODBC、OLEDB、ADO.NET、JDBC、PHP 和 Node.js 驱动程序,用户需要在连接字符串中显式将 DNN 侦听器名称和端口指定为服务器名称。For ODBC, OLEDB, ADO.NET, JDBC, PHP, and Node.js drivers, users need to explicitly specify the DNN listener name and port as the server name in the connection string. 若要确保故障转移时的快速连接,请将 MultiSubnetFailover=True 添加到连接字符串(如果 SQL 客户端支持它)。To ensure rapid connectivity upon failover, add MultiSubnetFailover=True to the connection string if the SQL client supports it.

工具Tools

SQL Server Management StudiosqlcmdAzure Data StudioSQL Server Data Tools 的用户需要在连接字符串中显式将 DNN 侦听器名称和端口指定为服务器名称才能连接到侦听器。Users of SQL Server Management Studio, sqlcmd, Azure Data Studio, and SQL Server Data Tools need to explicitly specify the DNN listener name and port as the server name in the connection string to connect to the listener.

当前不支持通过 SQL Server Management Studio (SSMS) GUI 创建 DNN 侦听器。Creating the DNN listener via the SQL Server Management Studio (SSMS) GUI is currently not supported.

可用性组和 FCIAvailability groups and FCI

可以通过将故障转移群集实例 (FCI) 用作副本之一来配置 Always On 可用性组。You can configure an Always On availability group by using a failover cluster instance (FCI) as one of the replicas. 若要将此配置与 DNN 侦听器一起使用,故障转移群集实例还必须使用 DNN,因为无法将 FCI 虚拟 IP 地址放入 AG DNN IP 列表中。For this configuration to work with the DNN listener, the failover cluster instance must also use the DNN as there is no way to put the FCI virtual IP address in the AG DNN IP list.

在此配置中,FCI 副本的镜像终结点 URL 需要使用 FCI DNN。In this configuration, the mirroring endpoint URL for the FCI replica needs to use the FCI DNN. 同样,如果将 FCI 用作只读副本,则到 FCI 副本的只读路由需要使用 FCI DNN。Likewise, if the FCI is used as a read-only replica, the read-only routing to the FCI replica needs to use the FCI DNN.

镜像终结点的格式为:ENDPOINT_URL = 'TCP://<FCI DNN DNS name>:<mirroring endpoint port>'The format for the mirroring endpoint is: ENDPOINT_URL = 'TCP://<FCI DNN DNS name>:<mirroring endpoint port>'.

例如,如果你的 FCI DNN DNS 名称为 dnnlsnr,并且 5022 是 FCI 的镜像终结点的端口,则用于创建终结点 URL 的 Transact-SQL (T-SQL) 代码片段如下所示:For example, if your FCI DNN DNS name is dnnlsnr, and 5022 is the port of the FCI's mirroring endpoint, the Transact-SQL (T-SQL) code snippet to create the endpoint URL looks like:

ENDPOINT_URL = 'TCP://dnnlsnr:5022'

类似地,只读路由 URL 的格式为:TCP://<FCI DNN DNS name>:<SQL Server instance port>Likewise, the format for the read-only routing URL is: TCP://<FCI DNN DNS name>:<SQL Server instance port>.

例如,如果你的 DNN DNS 名称为 dnnlsnr,并且 1444 是只读目标 SQL Server FCI 使用的端口,则用于创建只读路由 URL 的 T-SQL 代码片段如下所示:For example, if your DNN DNS name is dnnlsnr, and 1444 is the port used by the read-only target SQL Server FCI, the T-SQL code snippet to create the read-only routing URL looks like:

READ_ONLY_ROUTING_URL = 'TCP://dnnlsnr:1444'

如果端口是默认的 1433 端口,则可在 URL 中省略该端口。You can omit the port in the URL if it is the default 1433 port. 对于命名实例,请为其配置静态端口,并在只读路由 URL 中指定该端口。For a named instance, configure a static port for the named instance and specify it in the read-only routing URL.

分布式可用性组Distributed availability group

DNN 侦听器目前不支持分布式可用性组。Distributed availability groups are not currently supported with the DNN listener.

复制Replication

事务性复制、合并复制和快照复制都支持在连接到侦听器的复制对象中将 VNN 侦听器替换为 DNN 侦听器和端口。Transactional, Merge, and Snapshot Replication all support replacing the VNN listener with the DNN listener and port in replication objects that connect to the listener.

有关如何对可用性组使用复制的详细信息,请参阅发布服务器和 AG订阅服务器和 AG以及分发服务器和 AGFor more information on how to use replication with availability groups, see Publisher and AG, Subscriber and AG, and Distributor and AG.

MSDTCMSDTC

支持本地和群集化 MSDTC,但 MSDTC 使用动态端口,这需要使用标准 Azure 负载均衡器来配置 HA 端口。Both local and clustered MSDTC are supported but MSDTC uses a dynamic port, which requires a standard Azure Load Balancer to configure the HA port. 因此,VM 必须使用标准 IP 预留,否则它无法向 Internet 公开。As such, either the VM must use a standard IP reservation, or it cannot be exposed to the internet.

定义两个规则,一个用于 RPC 端点映射程序端口 135,一个用于真实的 MSDTC 端口。Define two rules, one for the RPC Endpoint Mapper port 135, and one for the real MSDTC port. 故障转移后,当 MSDTC 端口在新节点上进行了更改,可修改 LB 规则,改用新端口。After failover, modify the LB rule to the new MSDTC port after it changes on the new node.

如果 MSDTC 是本地的,请务必允许出站通信。If the MSDTC is local, be sure to allow outbound communication.

分布式查询Distributed query

分布式查询依赖于链接服务器,可以使用 AG DNN 侦听器和端口配置该服务器。Distributed query relies on a linked server, which can be configured using the AG DNN listener and port. 如果端口不是 1433,则在配置链接服务器时,请在 SQL Server Management Studio (SSMS) 中选择“使用其他数据源”选项。If the port is not 1433, choose the Use other data source option in SQL Server Management Studio (SSMS) when configuring your linked server.

FileStreamFileStream

文件流受支持,但不适用于用户通过 Windows 文件 API 访问具有作用域的文件共享的场景。Filestream is supported but not for scenarios where users access the scoped file share by using the Windows File API.

FileTableFiletable

FileTable 受支持,但不适用于用户通过 Windows 文件 API 访问具有作用域的文件共享的场景。Filetable is supported but not for scenarios where users access the scoped file share by using the Windows File API.

链接服务器Linked servers

使用 AG DNN 侦听器名称和端口配置链接服务器。Configure the linked server using the AG DNN listener name and port. 如果端口不是 1433,则在配置链接服务器时,请在 SQL Server Management Studio (SSMS) 中选择“使用其他数据源”选项。If the port is not 1433, choose the Use other data source option in SQL Server Management Studio (SSMS) when configuring your linked server.

常见问题Frequently asked questions

  • 哪个 SQL Server 版本引入了 AG DNN 侦听器支持?Which SQL Server version brings AG DNN listener support?

    SQL Server 2019 CU8 及更高版本。SQL Server 2019 CU8 and later.

  • 使用 DNN 侦听器时的预期故障转移时间是多少?What is the expected failover time when the DNN listener is used?

    对于 DNN 侦听器,故障转移时间将恰好是 AG 故障转移时间,没有额外的时间(例如使用 Azure 负载均衡器时的探测时间)。For DNN listener, the failover time will be just the AG failover time, without any additional time (like probe time when you're using Azure Load Balancer).

  • 若要支持将 DNN 与 OLEDB 和 ODBC 一起使用,对 SQL 客户端是否有任何版本要求?Is there any version requirement for SQL clients to support DNN with OLEDB and ODBC?

    建议使用针对 DNN 侦听器的 MultiSubnetFailover=True 连接字符串支持。We recommend MultiSubnetFailover=True connection string support for DNN listener. 它从 SQL Server 2012 (11.x) 开始提供。It's available starting with SQL Server 2012 (11.x).

  • 使用 DNN 侦听器需要更改 SQL Server 配置吗?Are any SQL Server configuration changes required for me to use the DNN listener?

    SQL Server 不要求更改配置才能使用 DNN,但某些 SQL Server 功能可能需要额外注意一些事项。SQL Server does not require any configuration change to use DNN, but some SQL Server features might require more consideration.

  • DNN 是否支持多子网群集?Does DNN support multiple-subnet clusters?

    是。Yes. 群集会将 DNS 中的 DNN 绑定到可用性组中所有副本的物理 IP 地址,不考虑子网。The cluster binds the DNN in DNS with the physical IP addresses of all replicas in the availability regardless of the subnet. SQL 客户端会尝试 DNS 名称的所有 IP 地址,不考虑子网。The SQL client tries all IP addresses of the DNS name regardless of the subnet.

后续步骤Next steps

有关详细信息,请参阅:For more information, see: