Thursday, March 24, 2011

Datacenter Activation Coordination mode

In a scenario where the first datacenter contains two DAG members and the witness server, and the second datacenter contains two other DAG members. If the first datacenter loses power and you activate the DAG in the second datacenter (for example, by activating the alternate file share witness in the second datacenter), if the first datacenter is restored without network connectivity to the second datacenter, the DAG may enter a split brain syndrome.

Datacenter Activation Coordination (DAC) mode prevents split brain syndrome from occurring by including a protocol called Datacenter Activation Coordination Protocol (DACP). After a catastrophic failure, when the DAG recovers, it won't automatically mount databases even though the DAG has a quorum. Instead DACP is used to determine the current state of the DAG and whether Active Manager should attempt to mount the databases.

Datacenter Activation Coordination (DAC) mode is disabled by default.

Datacenter Activation Coordination (DAC) mode is disabled by default.
DACP was created to address this issue. Active Manager stores a bit in memory (either a 0 or a 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 (which would be any DAG with three or more members), each time Active Manager starts up the bit is set to 0, meaning it isn't allowed to mount databases. Because it's 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 its bit is set to 1, it means servers are allowed to mount databases, so the server starting up sets its bit to 1 and mounts its databases.

But when you recover from a primary datacenter power outage where the servers are recovered but WAN connectivity has not been restored, all of the DAG members in the primary datacenter will have a DACP bit value of 0; and therefore none of the servers starting back up in the recovered primary datacenter will mount databases, because none of them can communicate with a DAG member that has a DACP bit value of 1.

To enable DAC mode use the following powershell command:

Set-DatabaseAvailabilityGroup -Identity TOPHDAG01 -DatacenterActivationMode DagOnly


To view weather DAC mode is enabled you may run:

(Get-DatabaseAvailabilityGroup).DatacenterActivationMode

This will say either Off or DagOnly

1 comment:

  1. Excellent pieces. Keep posting such kind of information on your blog. I really impressed by your blog.

    ReplyDelete