Friday 31 August 2012

Configuring Database Availability Group

1)      Directory services – Win2k3ad.happy.com

2)      Domain Name System (DNS) name resolution – Win2k3.happy.com
3)      File Share Witness (FSW) – Non –Exchange Server (Member Server)
4)      2 DAG Servers – DAG1 & DAG2
Current Configuration:
I have the following server setup:
1)      Win2k3AD – This is my AD & DNS for happy.com
2)      A Member Server – This is just a placeholder for my File Witness Share
3)      DAG-1 – My DAG Member Server
a.       Public Ip Address : 192.168.1.11
b.      HeartBeat – 10.10.10.10

4)      DAG-2 – My DAG Member Server
a.       Public Ip Address : 192.168.1.12
b.      HeartBeat – 10.10.10.20
In Summary for the above:





Network Configuration
Host Name
FQDN
IP Address
Default Gateway
DNS
OS Version
Service
Win2k3ad
Win2k3ad.happy.com
192.168.1.1
192.168.1.1
192.168.1.1
Win2k3 Sp2
AD & DNS
E2K10
E2k10.happy.com
192.168.1.x
192.168.1.1
192.168.1.1
Win2k8R2
FSW
DAG-1
DAG-1.happy.com
192.168.1.5
192.168.1.1
192.168.1.1
Win2k8R2
E2K10SP1
DAG-2
DAG-2.happy.com
192.168.1.4
192.168.1.1
192.168.1.1
Win2k8R2
E2K10SP1
DAG-1 (RN)

10.10.10.10




DAG-2 (RN)

10.10.10.20





 

Note : It is recommended to have static routes between the replication network and for this we can use netsh
Inorder to configure routing between replication network copy paste this command on the replication network server
netsh interface ipv4 add route 10.10.10.0/24 Replication 10.10.10.254
Ensure that Register this connection's addresses in DNS is cleared for Replication Network
 
Network Adapter Configuration
Features
Mapi Network
Replication Network
Client for Microsoft Networks
Enable
Disbale
QoS Packet Scheduler
Not Necessary
Not Necessary
File and Printer Sharing for Microsoft Networks
Enable
Disable
Internet Protocol Version 4 (TCP/IP v4)
Enable
Enable
Internet Protocol Version 6 (TCP/IP v6)
Not Necessary
Not Necessary
Link-Layer Topology Discovery Mapper I/O Driver
Enable
Enable
Link-Layer Topology Discovery Responder
Enable
Enable


FSW Consideration:
There is no hard or any major requirement for File Share Witness server. It can run on any sort of configuration and can be any server. Recommend to have member server instead of DC. And also it is very important for you to understand when you should go FSW model, for more details see my last article which talks about How the Failover occurs for DAG.
Deployment of DAG:
So far I hope you are aware about the setup model which I planned for DAG. Now let’s get into the creation of DAG.
Just to summarize in short…
Already I have exchange 2010 in place for DAG. For Each Server  I have two independent disk database storage. Now we are in the process of creating the DAG.
Key Notes:
1)      DAG can be supported upto 16 copies
2)      Unique Name for the DAG should not be more than 15 characters.
3)      Without using DatabaseAvailabilityGroupIpAddresses parameter it will assign an IP address from DHCP server
4)      Always keep static routes between the replication network
Step1 : Creation of DAG
Inorder to create DAG you can use either EMC or EMS. Both of them will work, however my personal recommendation is to use EMS. The reason behind this is, you can do modulation as per your requirement in one single line. Like let say we need a DAG to use static ip address then EMS will be the possible way, another reason adding the DAG for different Subnet Exchange Server.
Based on my above recommendation I am going to create folder called as DAG which is going to have static ip address 192.168.1.7 and witness directory path location for this DAG will be one of my member server “SCCM.happy.com”
Note: If I am using simple command just like providing the cmdlet to create new-databaseavailablitygroup with a name called as DAG. It will try to find my hub server which doesn’t have any mailbox server role installed automatically. In my case I don’t have any single stand-alone server which is having only hub server so that’s why I am going to specify my DAG hosting  servername.
The command which I am going to use it here as follows:
New-DatabaseAvailabilityGroup -Name DAG -WitnessServer SCCM -WitnessDirectory C:\DAG -DatabaseAvailabilityGroupIPAddresses 192.168.1.7
Let’s understand more on the above command,
New-DatabaseAvailabilityGroup: It is the parameter which will create Database Availability Group
-Name: Specify the name for the DAG which you need to create, example I called it as DAG.
-WitnessServer: Witness Server is nothing but a File Witness Shareholding server. In Exchange 2007 we had a concept of CCR where both the servers are having disk independent with each other and there are lot of chance both the server can own the ownership of the exchange database, so inorder to avoid this Microsoft introduced a concept called a File Share Witness share where we will have witness directory. This FSW Server will decide who is going to own the ownership based on the voting poll. In our example I chosen a non-exchange server – SCCM
WitnessDirectory : Witness Directory is a folder which will be created under FSW Server. This Witness Directory folder will the witness log files which will keep a track of DAG responses.

 
The above screen shows the folder location where the witness Directory is created under FSW Server.
Once we run the new-databaseavailabilty command, it will configure the DAG Configuration Folder in the FSW Server and in the organization it will create a New DAG

Note:
Ø  Witness Directory folder will be seen after you add the Exchange Server in DAG.
Ø  Before you execute the above command and if your server is a non-exchange Server then you need to add this server to “Exchange Trusted Subsystem” Universal Security Group.
Ø  If the server is a non-exchange ensure that your DAG Server is part of the Local Administrator Group of the non-exchange server.
Step2: Add Mailbox Server to the DAG
Now Add the Exchange Server into the newly created DAG Container. For me the Exchange Server is DAG-1 & DAG-2, and inorder to add this you can use EMC or EMS.
If you are using EMC, Expand the Organization, click on Mailbox, click on “Database Availability Group” Tab, right click DAG Container and select “Manage Database Availability Group Membership” then click on ADD and add those two Servers and finally click on Manage:

Instead of EMC if you would like to add the servers through EMS then type the following command
Add-DatabaseAvailabilityGroupServer -MailboxServer 'DAG-1' -Identity 'DAG'
Add-DatabaseAvailabilityGroupServer -MailboxServer 'DAG-2' -Identity 'DAG'
Once you add the Servers in the DAG, you will the servers in the Member Servers

 
Step 3: Configuration of DAG (Optional):
Most of the DAG configuration we had covered while creating the DAG, but still I would like to share you some of the other few optional which can be utilized as per the need.
Ø  Alternate Witness Server & Alternate Witness Directory : Now let say due to some or the other reason if your FSW crashed or network outage, it will be kind of bit risk to run the show just because incase of any sort of network failure between the exchange servers then any server can take the ownership. So Ms came with a new option called as Alternate Witness Server

Ø  If you forget to configure the static ip address, bydefault DAG will take an ip address from DHCP server, later if you want to configure static ip address you can use the following command
Set-DatabaseAvailabilityGroup -Identity DAG -DatabaseAvailabilityGroupIPAddresses 192.168.1.7
Ø  If you are having DAG across different site then you need to configure static ip address for each site location
Set-DatabaseAvailabilityGroup –Identity DAG1 –DatabaseAvailabilityGroupIPAddresses 192.168.1.7,192.168.0.7
Ø  Enabling DAC : Set-DatabaseAvailabilityGroup -Identity DAG -DatacenterActivationMode DagOnly
Note: Bydefault DAC will be disabled and it should be enabled if you are having more than 3 exchange servers across multiple AD Sites. This command will avoid split brain syndrome.
Ø  Replication Port Configuration: Bydefault DAG will use 64327 port for log shipping and seeding. Sometime it might be concern because this port is a dynamic range defined by IANA & according to IANA dynamic ports cannot be registered, so if you want you can change the port by executing the following command:
Set-DatabaseAvailabilityGroup -Identity DAGID –ReplicationPort portnumber
And also ensure that new port which has been updated needs to allowed in the firewalls.
Ø  If you want to see the current configuration details in much more details then execute the following command:
Get-DatabaseAvailabilityGroup | Fl

Step4: Add Mailbox Database Copies:
So far we configured the DAG, now it is a time to add the mailbox database into the DAG. Inorder to do this:
Ø  Open the EMS and execute the following command
Add-MailboxDatabaseCopy -Identity Database1 -MailboxServer Dag-2
Add-MailboxDatabaseCopy -Identity Database2 -MailboxServer Dag-1
Note: If you want to set activation preference you can set that one also by adding –activationpreference.

Note: When you execute add-mailboxdatabase copy, it will seed the database and log file shipping to the exact drive name what we have it for the master database copy. Let say if my master Database is in the E Drive of DAG-2, it will place the database copy in the E Drive of DAG-1
Master Copy Location:

MailboxDatabase Copy Location:

Step5: Validate the DAG Configuration:
Now we are in a good stage where we have database high availability, however before we put this server under production it is very important for us to validate
Ø  Run Test-replicationhealth command from the EMS:
Test-ReplicationHealth -Identity Dag1

Ø  Check the MailboxDatabaseCopyStatus
Get-MailboxDatabaseCopyStatus -Identity Database2 | FL
Ø  Check the database copies on a particular server :  
Get-MailboxDatabaseCopyStatus -Server DAG-1 | FL
Ø  Check the application and system log for any errors
Ø  To make our life much more easy in Exchange 2010, we have scripts to find the performance and counters metrics, replication metrics etc..
o   CollectOverMetrics.ps1
o   CollectReplicationMetrics.ps1
o   CheckDatabaseRedundancy.ps1
Ø  Apart from the above, administrator can try the following:
o   Shutdown the primary server
o   Remove the Disk and see the status
o   Unplug network cable
o   Shutdown the FSW server to check activity of Alternate FSW
I just did a small test: Shutting down the DAG-1 Server .

No comments:

Post a Comment