Sunday, April 24, 2011

Lots of customers ask if their server is down, will they be switched to another server so that their websites/applications are not down. If the customer is a layman, he/she will always expect the host to provide them automatic failover so that their websites are not down. However, they are not aware of the costs they have to incur for such a solution. However, the hosts can still provide them a simple failover solution with a fraction of the cost. Here is a simple way to create a Windows failover solution assuming that the server has websites running on IIS and using MS SQL server databases.

1. IIS Mirroring

Here is an URL explaining how to setup IIS Mirroring

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/81f04967-f02f-4845-9795-bad2fe1a1687.mspx?mfr=true

2 . Data Mirroring

For Data mirroring, you can use Robocopy which is available with Windows 2003 Resource kit for Windows 2003 and is built-in with Windows 2008. You can create a batch file on the primary server which will mirror the data to the backup server using Robocopy. It is done using the /MIR switch of Robocopy which keeps exactly the same copy of the source server in the backup server. If a file or a directory is deleted from the source server, it will be removed from the destination server too. You simply have to run the batch file once wherein it will do a full backup and for all the new runs, it will be incremental. You can schedule the batch file to run every few minutes, say around 15 minutes since it will copy only the new data and the changed data. However, for a shared hosting server hosting a few hundred websites, you may have to increase the interval.

3. MS SQL Mirroring

MS SQL server has built-in option for database mirroring. You can visit http://sqlserver-training.com/how-to-perform-sql-server-mirroring-manual-failover to setup database mirroring.

4. DNS Failover

There are a few companies like DNSMadeEasy which provide DNS failover. You can buy a DNS failover package from such companies which can be useful for DNS failover if the primary server goes down.

The above method definitely saves cost, but still you need to deploy multiple server(s) to achieve this. However, compared to hardware available for Mirroring and Failover the cost is very less. After all, you cannot have everything free.