AlwaysOn AG,带故障转移的 DTC

Eli*_*gne 14 sql-server msdtc availability-groups

问题:如何在 AlwaysOn 可用性组 (AG) 中的所有服务器上运行分布式事务协调器 (DTC)?我不需要在故障转移/切换事件上维护事务。

设置:我有一个带有三台 Windows 2008 R2 服务器的 Windows 故障转移群集 (WSFC),它们都运行 SQL 2012。两台服务器位于一个数据中心,是 AlwaysOn 故障转移群集 (FCI) 的一部分,而第三台服务器位于第二个数据中心。WSFC 是一个多子网集群。这是设置的草图: 在此处输入图片说明

我已经能够安装和配置 DTC 以在两个 FCI 节点之间工作,因为它们位于同一子网上并共享存储。我已经配置了几个 AG,它们运行良好。此屏幕截图显示安装在 FCI 上的 DTC:

在此处输入图片说明

此屏幕截图显示我可以在其中一个 FCI 节点(以处于活动状态的节点为准)上配置 DTC: 在此处输入图片说明

我想将使用 DTC 的应用程序迁移到此集群并使用 AG。我读过 AG(参考)不支持 DTC 。我一直找不到在第二个数据中心的第三个节点上配置 DTC 的方法。当我尝试在第三个节点上配置 DTC 时,它似乎不可用,如下图所示:

在此处输入图片说明

在 Brent Ozar 的Free Setup Checklist PDF for Availability Groups 中,他列出了:

集群安装...

29. 如果涉及 FCI,请根据您的计划部分的决定配置 DTC。

In the comments on SQL Server 2012 AlwaysOn Availability Groups Rock Brent says that "... nothing changes when AGs are in play. Just keep in mind that databases in an Availability Group don’t support transactional consistency when failed over together to another replica..."

This makes it seem that DTC can be used in Availability Groups as long as you understand that transactions will not be maintained in a AG switchover. I would not need it to maintain transactions from the FCI nodes. I would just need DTC available for the application to use in the case of a catastrophic disaster (where I lost my primary data center).

How do I configure DTC on my third node? Or, is it the case that I'm just out of luck when it comes to using AGs and an application that needs DTC?

UPDATE: The solution I've settled on is to use Log Shipping. However, in the case of a fail over, I still need DTC to be available on Node3. I've discovered that it becomes available by uninstalling the clustered MSDTC-MSSQLSERVERCLU instance of DTC that is shared between Node1 and Node2. Once removed, I can setup and configure a LocalDTC instance on Node3. Afterwards, I can reinstall the clustered MSDTC-MSSQLSERVERCLU instance. Doing the install sequence in that order seems to work. I've been running like that for a little while now and I have not discovered any ill effects. It seems like this would also work for running an AlwaysOn Availability Group. I understand that distributed transactions would not be preserved in an AG failover, I would just need new ones to work after the failover. But I haven't gone there...

Bre*_*zar 16

以利亚。这里有两个单独的问题:

1. AlwaysOn 可用性组是否支持 DTC?

您使用的是 SQL Server 2012,根据 Microsoft 的文档,答案是否定的。我完全理解您无论如何都想尝试一下,但请记住,您现在正在将 Microsoft 根本不支持的东西投入生产,并且您正在同时使用两个单独的利基功能(AG 和 DTC)。如果出现任何问题,您将进入一个受伤的世界。这只是我什至不会考虑在生产中尝试的事情。

请记住,如果您的经理发现您部署了 Microsoft 专门用大写字母“您不能这样做”的内容,并且您遇到任何类型的中断而您必须致电 Microsoft 寻求支持,那么您将有一些丑陋的解释要做。

从技术上讲,从 SQL Server 2016 SP2 及更高版本开始支持 DTC,但这只是意味着您可以选择哪个数据库在故障转移时丢失数据,而应用程序不知道数据已永久丢失。这不是普通数据库管理员所说的 DTC 支持。

2、多节点、多子网集群中DTC应该如何配置?

阅读Allan Hirt 关于在集群中使用多个 SQL Server 实例配置 DTC 的帖子,并确保阅读帖子中的所有链接。