How to Configure Multiple Instances of Distributed Transaction Coordinator (DTC) on a Windows Server Failover Cluster 2008

How to Configure Multiple Instances of Distributed Transaction Coordinator (DTC) on a Windows Server Failover Cluster 2008

  • Comments 5
  • Likes

What we will be going over in this blog is one of the improvements of Distributed Transaction Coordinator (DTC) on a Windows Server Failover Cluster 2008. The Distributed Transaction Coordinator is a transaction manager which permits client applications to include several different sources of data in one transaction and which then coordinates committing the distributed transaction across all the servers that are enlisted in the transaction.

In versions of Failover Clusters from previous operating systems such as Windows Advanced Server 2000 and Windows Server 2003, it only allowed you to configure a single instance of DTC on a Cluster. If the DTC was in a group that was active on Node B, it would act as the transaction manager for the whole Cluster. Then the application and resource manager on Node A whenever needed would call the DTC proxy. The DTC proxy on Node A would then forward all MS DTC calls to the DTC on Node B.

DTC Architecture in Windows Advanced Server 2000 and Windows Server 2003 Failover Clusters

image

If Node B fails, then the DTC on Node A would take over. It reads the DTC log file on the shared disk, performs recovery, and then serves as the transaction manager for the entire Cluster.

Unlike the previous operating systems with the improvements made on a Windows Server Failover Cluster 2008, you are now allowed to have multiple instances of DTC resources all active at the same time referred to as Active-Active DTC. This same principal can be applied to services or applications such as SQL Server, Exchange, MSMQ or any application that needs to make a distributed transaction API call.

As you can see, we have 3 mechanisms of associating a DTC resource with a service or application:

· 1st – Is a programmatic way, by using a function calls such as DtcGetTransactionManagerEx.

· 2nd – Command line configuration, by using MSDTC.exe from a command line interface (CLI).

· 3rd – Administration User Interface (UI), by using DCOMCnfg.exe.

By default, each system uses its local Distributed Transaction Coordinator (DTC) transaction manager which is installed by the operating system for initiating and coordinating transactions. However, you can configure your computer to use the DTC transaction manager of another system as the default transaction coordinator. The DTC transaction manager on the specified system is used as the transaction coordinator whenever a client on the local system begins a DTC transaction and that client does not explicitly specify a transaction coordinator.

DTC Architecture in Windows Server 2008 Failover Cluster

image

The default transaction coordinator coordinates all transactions that are initiated by COM+ or any other client that uses transactions. The default transaction coordinator also serves as the transaction coordinator for all resource managers on the local system that enlist in any DTC transaction.

So in theory, you can have an application which requires DTC that can be Clustered or non-Clustered. Some applications use a DtcGetTransactionManagerEx API function call as listed in the DTC Programmer's Reference documentation by passing in the Cluster resourceId. You would need to configure the application to specifically map to a particular DTC instance; otherwise if it has to fallback it would use the following rules:

  • If there is a DTC resource instance that is part of that Cluster resource, it will be used.
  • If not, and there is a Cluster default DTC instance available, it will be used.
  • If there are no Cluster instances available, then a local DTC instance will be used with a notification of a potential loss of availability.

In some cases, you may have a legacy application which doesn’t use the new parameters available in DtcGetTransactionManagerEx in which case,

  • The application will pick the Cluster default if present.
  • If Cluster default is not present it will use the local DTC.

To enable legacy applications to optimally pick the DTC instance and application that is in the same Cluster group, you can use the command line to configure the application to pick a particular DTC instance using the syntax below.

msdtc.exe -tmMappingSet -name
    [-exe <pathname> | -service <full service name> | -complusappID  <app ID>]
    [-local|-ClusterResourceName <resource name>]

Then the legacy DtcGetTransactionManagerEx call will pick the configured DTC instance in the same group as the application instead of Cluster default.  See some examples listed below.

image

image

 

 

 

 

 

 

 

 

 

 

As in previous operating systems, it is not necessary to reset the DTC log file to reclaim disk space within the file because the DTC does this automatically. When a transaction has successfully been committed or aborted, the DTC notes that the log records are no longer needed and it eventually reuses the space for other transactions.

Keep in mind that resetting the MSDTC log will cause all knowledge of currently processed transactions to be lost, and your RMs (Resource Manager) will have to be manually resolved.  Resetting the log isn't required under any normal operation, unless they were corrupted or lost. Using the CLI msdtc -resetlog still works in Windows Server 2008, but it will only reset the local MSDTC log file.

Now with the improvements of Active-Active DTC from the command prompt, you should be using syntax below for resetting each individual Clustered DTC resource instance whenever needed:

msdtc -resetclustertmlog {guid}

   - or -

msdtc -resetclustertmlog <resource_name>

Where {guid} is the GUID of the DTC resource (this is the name of the folder that that Cluster log resides in on a shared disk), and <resource_name> is the name of the MSDTC resource listed in the Failover Clustering interface.

For further information on some tools used for troubleshooting DTC you can visit any of the following links:

o DtcTrace, TraceFmt, MSDTCVTr, DtcPing, and DtcTester.

The steps listed below are for creating MSDTC in any group such as SQL Server, Exchange, MSMQ or any application that needs to make a distributed transaction API call.

Clustered MSMQ Group in Failover Cluster Management snap-in

image

One way of adding a DTC resource to a group, is by simply running through the High Availability Wizard to setup DTC to be highly available. Then just right-click on DTC and move it to whatever group you want to be in as seen in Figure 1.0 (below).

NOTE: Doing it this way means, all resources tied to DTC will move as well. So changes on the Dependencies tab for DTC would need to be made, if you wish to eliminate duplicate resources (such as Network Name, IP Address and Disk) in the particular service or application DTC moved into. You also need to make sure you go into Windows Firewall in Control Panel and Change setting by enabling the resources necessary on the Exceptions tab.

image

 

Figure 1.0

image

image

Another way of adding a DTC resource to a group, is by using an advanced procedure which is executed outside of any of the wizards that Cluster configuration normally uses.

1. To accomplish this, highlight the particular application group in the left-hand pane and in the right-hand Actions pane, select Add a resource, select the More resources…, then select Add Distributed Transaction Coordinator as seen in Figure 1.1:

Figure 1.1: Adding a DTC Resource in Failover Cluster Management snap-in Using Advanced Procedures

image

2. This will creates a DTC resource in the particular application group chosen and it will be in an Offline state. It is Offline as seen below, because it requires additional configuration by the user as seen in Figure 1.2:

Figure 1.2: DTC Resource Created in MSMQ Resource Application Group

image

3. To configure the DTC resource, right-click on the resource and select Properties from the drop down list as seen in Figure 1.3:

Figure 1.3: Selecting Properties Page for DTC Resource

image

4. Select the Dependencies tab and configure a dependency for a Physical Disk and Network Name resource as seen in Figure 1.4:

Figure 1.4: DTC Resource Dependency Information

image

5. After applying the changes and selecting OK, and bring the DTC resource Online as seen in Figure 1.5:

Figure 1.5: Bringing the DTC Resource Online in the Cluster

image

6. The resource should come Online and then failover can be tested as seen in Figure 1.6:

Figure 1.6: DTC Resource Online in Failover Cluster Management snap-in

image

7. If you use Windows Explorer to browse the disk, you will notice an MSDTC folder was created to support the DTC Log file for this instance.

Figure 1.7: MSDTC Folder on Shared Disk

image

Next, would be to configure the application instance in this case MSMQ to use the DTC resource in its own application group.

In Windows Server 2008, the first Clustered DTC resource becomes the default Clustered coordinator. So all services/applications unless otherwise specified will use the default Clustered coordinator by default. Let’s take the following situation where the Failover Cluster is hosting both MSMQ1 and MSMQ2, by default all MSMQ instances would use the default Clustered coordinator.

8. To avoid any confusion, we could explicitly map each DTC resource instance to each MSMQ instance with the msdtc.exe command as per the Map Clustered MS DTC Resources reference.

image

So let’s say that the MSMQ Service names are MSMQ-MSMQ-1 and MSMQ-MSMQ-2, then the DTC resource names are DTC-1 and DTC-2.

To map MSMQ-MSMQ-1 to DTC resource in the same service or application group, run the following command:

     Msdtc tmMappingSet name Mapping1 service MSMQ-MSMQ-1 ClusterResourceName MSDTC-MSMQ-1

To map MSMQ-MSMQ-2 to DTC resource in its own DTC service or application group, run the following command:

   Msdtc tmMappingSet name Mapping2 service MSMQ-MSMQ-2 ClusterResourceName MSDTC-DTC-2

NOTE: Syntax is important, if the first hyphen is missed on tmMappingSet you may not get any dialog box. Otherwise, if any hyphens from subsequent parameters are missed, resource names are misspelled or don't exist then you will get some form of dialog box for further troubleshooting.

Then you can run the following to see all the mappings:

Msdtc –tmmappingview *

image

Or open Registry editor and look at the following key:

HKEY_LOCAL_MACHINE\Cluster\MSDTC\\TMMapping\Service\

o Under Service you should see Mapping1 and Mapping2 which is what links the service or application resource back to a specific DTC instance.

image

Another thing to take notice, is in Services each MSDTC Clustered instance is identified by a unique Cluster resource {GUID} while services or applications such as SQL Server, Exchange, MSMQ or any applications are identified by the actual Cluster resource name given.

image

By using the Administration UI through DCOMCnfg.exe, you can manage all the Clustered DTC resources including the Local DTC. Some additional tasks that are available through the Administration UI that people may find very useful are things such as Tracing, Logging options, Security setting and Transaction Manager Communication settings.

image 

image 

 

image

image

 

By launching the Component Services Administration UI using DCOMCnfg.exe on each node, is where the Cluster Default Coordinator resource.

On a stand-alone server, when you go to the Properties of My Computer, then on the MSDTC tab you would notice a Default Coordinator and checkbox to Use local coordinator or you can uncheck the box and point it to a Remote coordinator host name of another server on the domain.

Once several servers form a Failover Cluster, when you go to the Properties of My Computer, then on the MSDTC tab of any node of the Cluster you would notice a Cluster Default Coordinator and the dropdown list is empty until the very first Clustered DTC resource is created. If multiple DTC resource instances are created to take advantage of Active-Active DTC, the from the dropdown list on each node you can choose which Cluster default coordinator resource name that node will use.

 

image

image

image

 

RELATED RESOURCE REFERENCE(S):

Understanding MS DTC Resources in Windows Server 2003 Failover Clusters

Understanding MS DTC Resources in Windows Server 2008 Failover Clusters

Map Clustered MS DTC Resources

DTC Administration Guide

DTC Developers Guide

DTC Programmers Reference

MSDTC changes in WS2008, Part 1: Introduction

MSDTC changes in WS2008, Part 2: Cluster requirements

MSDTC changes in WS2008, Part 3: Cluster features

MSDTC changes in WS2008, Part 4: Miscellaneous features

 

 

Mike Rosado
Senior Support Engineer
Microsoft Enterprise Platforms Support

 

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment