Monday, May 31, 2010

Creating a HA cluster using VMware and MSCS

Building a Virtual Cluster Server with VMWare and MSCS
Today's companies have tendencies to virtualize everything. Is this good or bad, this is another discussion. The fact is that with virtualization, you can simply build a cluster environment as a POC for a project. This can also be used for training, demonstration and even post-sales support. This article is an extract of a full documentation I am writing. It explains step by steps how to configure VMWare with Microsoft Cluster Service (MSCS) and a Virtual SQL Server.

What you need (recommended specifications)
- a powerful server with
- CPU: dual-core P4 3Ghz or Xeon 2Ghz
- RAM: 4Gb
- HDD: 50 Gb of free space
- 1 VMWare running Windows Server 2003 Enterprise Edition.
- SQL Server 2000 SP3/SP4 Enterprise or 2005 Enterprise
- VMWare (I used VMWare Server 1.0)
- a Microsoft Domain (Active Directory) and a Microsoft DNS Server (can run on VMWare)

1. Configuring the shared storage
A cluster server requires access to an identical, highly available, shared storage. Without using virtualization, this requires SCSI or fiber channel connected storage. With VMWare, you can simulate this by configuring on the VMWare settings the access to an identical -shared- virtual disk.
Edit your Windows Server 2003 Virtual Machine Settings and add 2 virtual disks. Your machine must obviously be stopped. Proceed as following:
- create a folder where you will place your virtual disks
- Edit your Windows Server 2003 Virtual Machine Settings
- create a virtual disk
- disk size 2Gb (do not allocate disk now)
- define your destination path as created previously + name your first disk CLUSTER_QUORUM
- select the advanced options: select the virtual device node to "SCSI 1:0" and the mode to "Independent" and "Persistent"
- create a second one named DATABASE_QUORUM on the virtual device node "SCSI 2:0".

2. VMWare Device configuration
Ok now let's make a point on the Devices configuration of your virtual machine. You should have:
- Memory: recommended 1Gb
- Hard Disk (SCSI 1:0) Independed-Persistant: this is the CLUSTER_QUORUM
- Hard Disk 2 (SCSI 2:0) Independed-Persistant: this is the DATABASE_QUORUM
- Hard Disk 3 (IDE 0:0): this is your local c: drive
- Ethernet (bridged by default)
- Ethernet 2 (bridged by default)
- Processor 1 or 2

3. Adding line in VMWare configuration file
This entire configuration is stored in the vmx file of your Virtual Machine. Edit it and take a look at it. You may want to do dome cleaning but make sure you did a backup of it before.
You'll need to add some line to make VMWare use a shared disk as it would do in real cluster hardware. You may use my sample code:

disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"

#scsi1 data storage
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedbus = "virtual"
scsi1:0.present = "TRUE"
scsi1:0.fileName = "E:\Cluster\storage\CLUSTER_QUORUM.vmdk"
scsi1:0.mode = "independent-persistent"
scsi1:0.shared = "TRUE"
scsi1:0.redo = ""

#scsi2 quorum
scsi2.present = "TRUE"
scsi2.virtualDev = "lsilogic"
Page 110 on 143
scsi2.sharedbus = "virtual"
scsi2:0.present = "TRUE"
scsi2:0.fileName = "E:\Cluster\storage\DATABASE_QUORUM.vmdk"
scsi2:0.mode = "independent-persistent"
scsi2:0.shared = "TRUE"
scsi2:0.redo = ""

4. Initialize and Convert Shared Disks
Start your Virtual machine by clicking and open the "Computer Management" dialog (Start > All Programs > Administrative Tools > Computer Management). Click on the Disk Management tree node and you'll immediately be prompted to with the "Initialize and Convert Disk Wizard".
- Do NOT convert any of the disks to dynamic since we need then to be basic so make sure that the two disks are unchecked.
- Create for each disk an extended partition of all the available size
- When this is done, create for in partition a logical drive of the available size, assign a drive letter and format it with NTFS with the quick format checkbox enabled.

5. Prepare your second node
To build the second server of your cluster, just power off your actual server (we'll call it Node 1) and duplicate the VMWare files (separate them into different folders).
You?ll need then to power on the Node 2, change the machine name and IP Address.

6. Network, Domain and DNS configuration
Your both nodes are running. It is now time to join the domain. We'll need them to be configured with fixed IP. The second NIC of each node should be configured with a and IPs. No need to put this in the DNS, this is just for the intra-cluster communication (aka Heart-Beat).
When this is done, have them joining your Active Directory.
Also you can prepare 1 IP and 1 name in the DNS for:
- Cluster
- SQL-Virtual SQL Server
- SQL-MSDTC (aka Distributed Coordinator)

7. Create your cluster.
Microsoft Windows Server comes with the Cluster feature by default installed (not like Windows 2000 Advanced Server).
In the administrative Tools, open the Cluster administrator.
Step by step procedure:
- you will automatically be prompted with the "create new cluster wizard"
- Enter then the cluster name as created in your DNS and in your domain
- Select the node on which you are working now, it will be the first member of the cluster. We'll add the second later
- Enter then a domain administrator user account (it is possible to restrict the rights/permission set if there would be a company security policy).
- Add the second node to the create cluster (you don't need to log on the second node, you can do it from Node 1)

8. Prepare the Cluster Group for SQL
In your Cluster Administrator panel, you now have two groups: "Cluster Group" and "Disk1 Group". Rename "Disk1 Group" to "Database Group".
Configure your network resources to match the internal network and public-network.

9. Create the MSDTC resource
MSDTC is a requirement for SQL Server when you need SSIS, Notification Services or Workstation. The Distributed Coordinator Service cannot be started on a Cluster Node. For this reason, it is required to create it as a Cluster Resource.
Proceed as explained in - How to configure Microsoft Distributed Transaction Coordinator on a Windows Server 2003 cluster: in the "Database Group"
- Create an IP address resource (SQL_MSDTC_IP)
- Create an Network Name resource (SQL_MSDTC_Name)
- Create an MSDTC resource (SQL_MSDTC_Resource): for the Resource Type, click to select Distributed Transaction Coordinator

10. Install your Virtual SQL Server
When prompted:
- install SQL Server Database Services AND a SQL Server failover cluster
- select the public IP address as defined in f.
- add your two nodes as part of the cluster
- select to create a default instance. If you want and active/active cluster, you will need to install a named instance afterward

1 comment:

  1. Hey arun cool stuf VM is really capturing every thing more than 40% of the servers in the infrastructure is all virtual