About Me

Monday 8 November 2010

VMware Vcenter redundancy using database mirroring technology

Overview


This document will instruct you on how to configure redundancy of the Vcenter service using MS SQL 2008 sp2 mirroring technology. This will enable services reliant on the Vcenter service to be brought back online in a timely manner such as, Xendesktop, DRS, etc. I am aware of Vmwares product Heartbeat; however this is a cost effective method to provide some sort of virtual center DR

 

This configuration will have a principal VC database and a mirrored copy of the VC database located on another server. This configuration will require a manual failover of the database in the event that the primary server fails or is taken offline and the IP address will need to be updated on the secondary server to enable Xendesktop DCC to continue to function. 

I am not using a witness disk in this tutorial which would enable automatically fail over of the database, to give myself better control of the fail over process. This of course is due to preference and is completely up to the engineers discursion.

In the event that the primary server is brought back online it will switch over to become the mirrored copy of the database and will synchronize any new changes that have been made once the mirroring service is manually resumed

Prerequisites for the purpose of this tutorial


2 x Windows Server 2008 R2 (virtual or physical)
2 x Instances of Vcenter 4.1
2 x instances of Windows 2008 SQL server installed on the virtual machines (Unless you are using a SQL Cluster which is highly recommended. Then of course SQL mirroring would be irrelevant

Steps to take to resume Vcenter service


If the server that holds the primary database becomes unavailable then the following is required:

1.       Manually failover the primary database
2.       Provide the primary server with a new IP address
3.       Configure the Secondary server with the primary servers original IP address
4.       Start the Vcenter service on the secondary server
5.       Reconnect the hosts (The hosts will be in a disconnected state because ESX hosts can only be managed by 1 vcenter server at any given time. Right click the host and choose the option to reconnect. Then enter the correct credentials for the Root account.

Installing Vcenter binaries


1.       Install Vcenter on the primary server using the standard Vcenter procedures using a local database
2.       Install Vcenter on the secondary server using the standard Vcenter procedures using a local database
3.       Once the Vcenter service has been installed successfully on the secondary server, stop the Vcenter services and delete the local database.
4.      Make sure to keep the ODCB connection available

Configure SQL mirroring


1.       Open SQL management studio
2.       Establish a connection to your second SQL server
3.       Locate the Vcenter Database
4.       Take a Full backup of the database using SMS backup functionality
5.       Copy the Vcenter database backup to the server that will be configured as the mirror
6.       Restore database using the database backup
7.       Located the Vcenter database on the primary server
Right click the datebase>Tasks>Mirror>Click on the configure security button
(In this configuration we will not be using a 3rd SQL server as a witness server because we do not want automatic failover)
















Click next

















Click next
















Click next

















Click on the connect button>Select the server that will host the mirrored copy of the database>Click Next

















If the SQL instances are configured using the same SQL service accounts this just click on next. If they use different accounts then enter the domain user account details
Example: Domainname\username



















Click on finish. This will now create the mirrored instance of the database










Click on start mirroring
















You will now notice that there is a principal and Mirror database in a synchronized state
Right click the Principal Vcenter database>tools>Launch Database mirroring monitor. This will provide you with insight on how the principal and mirrored database are performing.







 

Manual failover of SQL database


This is assuming that you have made the necessary IP configuration changes on both the primary and secondary server.
1.       In the event that the principal database goes offline, then it is necessary to carry out the following steps to failover the database. This will enable the mirrored database as the principal database copy.






Right click the database>New query
Enter the following statement:
ALTER DATABASE Database Name SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS
Press the execute button> (Wait approximately 30 Secs – Click on the refresh button and the database state should change from Mirror to Principal)







1.       Open up the services.msc of the server and start the Vcenter Services
2.       Establish a connection using the VSphere client and reconnect the hosts using the root credentials of each host

Bringing the failed server/service backup online


Once the instance of SQL server that failed is brought back online it will take the roll of mirror; however the database mirror will be in a suspended state.
















Right click principal database>task>mirror>Resume


















The mirror database will synchronise with the principal database














Refreshing the database will display that the databases are back in a synchronized state

Before anyone mention VM Vcenter Heart Beet Manager, yes it is a great product; however at a cost of £12,000 for a license it might not be suitable in all environments