Thursday, March 14, 2013

Using VM Replication to create a test environment

Often in IT you find yourself needing to test something. The requirements for that can range from the simple example of needing to install or upgrade software on one server to the seriously complex side of full regression tests using a software test suite that encompasses client machines, multiple servers and databases.

Before the advent of virtualization, this usually meant the system administrator had to support multiple servers for the same function. In other words, you might have 3 or 4 servers for a single database because of having to support development, qa, and user acceptance testing requirements.

Now, with hyper-v (or ESX), Veam Backup and Replication, and ZFS those tasks have been made significantly easier. Additionally, you can accomplish all of those things with less hardware and operating expenses.

We use Veam as our replication and backup software for our production Hyper-V virtual machines (VM's). The nice part of that setup (aside from the fact that its a solid and reliable product) is the way Veeam licenses their software. You pay per socket on the server you are backing up from. You do not pay for replication or backup targets. So, in other words, if you license your production server, you can back it up to as many destinations as you care to. That works out especially well for making a testing/qa/acceptance testing copy of every single one of your VM's to a (usually less expensive) test hypervisor. The only significant requirement for the test hypervisor is adequate memory. You don't even necessarily need a RAID array, a number of VM's can (slowly) run off the same single SATA drive.

Creating the replication job in Veeam is pretty straightforward. You select the VM's you want to replicate, the machine you want to replicate them to, and the default suffix to add (it puts _replica by default). I would recommend changing that to _development or _qatesting or something more indicative of what you're going to use it for.

Not a requirement, but it would be very beneficial (as you will see in a minute) if you could also make the target replication directory an iSCSI target on a ZFS datastore. The reason for this, is that managing snapshots on one test VM can easily be managed in Hyper-V manager. But trying to synchronize the snapshots and performing multiple rollbacks and restarts on 25 VM's would be a pain to say the least. If you had the option of snapshoting and rolling back the entire iSCSI target (easily done with a ZFS SAN backend) you can do multiple regression tests in a quick and painless (at least less painful) way.

The only “gotcha” or issue to work around here, is that you have to use a private virtual switch in the test hypervisor. This will keep you from having to reassign IP addresses, computer names, leave the domain, re-join a test domain, etc. If you live in an AD (active directory) environment, you really need a VM copy of your domain controller that is part of the replicated VM's. Not having to change a single setting on any of the servers or client machines is really really nice. Because you are using a private virtual switch, you have to connect to a client test VM or test server running your application or test software through hyper-v manager. Incovenient yes, but to me a small price to pay to get that much bang for your buck.

If you need further explanations or step by steps with screenshots of any part of that, leave me a comment and I can expand this blog post. No, I don't work for Veeam I just happen to love their B&R product :)