Sunday, April 28, 2013

Enable Datacenter Activation Coordination (DAC) Mode in Exchange 2010 DAG

Enable Datacenter Activation Coordination (DAC) Mode in Exchange 2010 DAG

Datacenter Activation Coordination (DAC) Mode is a property of a DAG which can be turned on or off. DAC mode is disabled by default and should only be enabled for DAGs with three or more DAG members that have been deployed in a multi-datacenter configuration. DAC mode shouldn’t be enabled for

  • 2 member DAGs where each member is in a different AD site
  • 2-16 member DAGs where all members are in the same AD site

In case you try to turn on DAC where it is not supported, an error will be returned.

Note: In the expected Exchange 2010 SP1, DAC mode will be extended to support two-member DAGs that have each member in a separate datacenter. In addition, DAC mode will be extended to support DAGs that have all members deployed in a single Active Directory site, including AD sites that have been extended to multiple locations. So in SP1, you can now use DAC mode for all DAGs with two or more members.

DAC mode is configured to avoid a “split brain syndrome”. I will explain with an example. Let’s say we have a four member DAG, with two servers in each datacenter. The primary datacenter hosts the witness server and hence will always be in quorum. Now, let’s say that a power outage occurs in the primary datacenter and the exchange admin activates the secondary datacenter with an alternate file share witness.
When the power is restored in the primary site, servers come online quicker than the WAN links. Hence, when the two DAG members and witness server comes online, it has a quorum (majority) and will try to activate the databases. This will cause a “split brain syndrome” where both datacenters think that they are hosting the active databases.
DAC mode was introduced to avoid this situation. When DAC mode is enabled and the DAG members come back online, they will leverage a protocol called Datacenter Activation Coordination Protocol (DACP) before trying to mount the databases.  The DACP is used to determine the current state of the DAG and whether Active Manager should try to mount the databases or not.
Now for the technical bit as to how DAC works!
Active Manager stores a bit in memory (either a 0 or  1) that tells the DAG whether it’s allowed to mount local databases that are assigned as active on the server. When a DAG is running in DAC mode, each time Active Manager starts up, the bit is set to 0, which means that it isn’t allowed to mount databases. When in DAC mode, the server must try to communicate with all other members of the DAG that it knows to get another DAG member to give it an answer as to whether it can mount local databases that are assigned as active to it. The answer comes in the form of the bit setting for other Active Managers in the DAG. If another server responds that it’s bit is set to 1, it means that servers are allowed to mount databases. Hence, the server starting up sets its bit to 1 and mounts its databases.
Let’s find how DAC helps in “split brain” scenario in our example. When power is restored to the primary datacenter, the servers come online before WAN links and all of the DAG members in the primary datacenter will have a DACP bit value of 0. Hence, none of the servers in the primary datacenter will mount databases as they cannot communicate with a DAG member that has a DACP bit value of 1.
DAC mode can be turned on by running the shell command below.
Set-DatabaseAvailabilityGroup –identity “DAGONE” –DatacenterActivationMode DagOnly