How to failover Virtual Machine in VMWare
Step by step procedure how to failover a virtual machine in VMware from one datacenter to another in VMware V-Center. Let’s say one data center is LONDON1 and LONDON2 simultaneously and virtual machine name is SERVER1. Here Virtual Machine must be of replicated category which only enabled VM capable for failover as a DR steps. You must have reserved DR IP while DR setup. Just to be aware replicated VM must be active in single datacenter at a time. This procedure is more conceptual and must be performed by SA having clear understanding of DR concepts and have exposure to Servers, Storage replication technology and V-Center. This involves many concepts and here is no exact step to step procedure but conceptually all steps have to be performed with high level of attention. RHEL 6 VM has been considered in this example .
VM name remains same either it works in any datacenter.
1. First of all note down datastore name where your virtual machine resides. This you can get by logging to V–Center and select your VM For example APPS__SERVERNAME_UID format. Here name convention must be different for all as it depends upon storage team practice what naming convention is used by your organization and how it is being configured in ESX environment. With datastore name please validate datastore replication status. This you can achieve by Storage Tool in environment or you can use script if any or any other means which is already in practice depending upon storage technology used in your environment like EMC SRDF Technology of Hitachi Replication Technology. datastore MUST be in sync state before proceeding with FAIL-OVER to avoid any data loss. Also please check if the datastore is exclusively used by VM which you are planning to failover. Also please collect the target VM configuration details like IP, Gateway, Subnet mask and H/W address.
2. Make changes in network configuration areas with the DR Address. This step can be done at a later stage too but it is always better to change it before failover because else you need to do it later from console which must be touch compared to doing it via putty session. In case of any RHEL6 VM you need to update /etc/hosts, /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth* file with DR IP, Gateway, subnet mask and H/W address based on DR details you need to collect prior to failover.
3. Make sure all application component have been shut down before proceeding further Power off the Virtual Machine in LONDON1.
4. Split the replication in RW mode. You must be having methods to do it in your env.
5. Bring up the datastore on the LONDON2 side by logging to ESX host where the VM can be brought up. In V-Center, Select the ESX host where datastore will be mounted which you can achieve by doing below.
Disable Lockdown Mode
Configuration -> Security Profile -> Lockdown Mode
Enable ESX Shell and SSH
Configuration -> Security Profile -> Services -> Properties
Above will give you ability to login to ESX host via SSH.
Again log in to ESX host using your credentials.
6. Search & Mount Datastore Once you are on the ESX shell, search for related datastore that needs to be mounted and mount it on target ESX host. # esxcfg-volume -l | grep -i <DATASTORE_NAME> 7. Mount the datastore # esxcfg-volume -M <DATASTORE_NAME>
8.Scan Datastore in V-Center
Once datastore is mounted go to V-Center, look for the ESX host and find the newly mounted datastore and browse it.
Configuration -> Storage
Find the virtual machine file and add it to inventory.
9. Power on the virtual machine and make IP changes if not done previously with target details.
10. Ask application team to validate application in DR site and create if any alias pointing to target IP. If all looks good from application perspective and confirms to stay at DR site only .In that case datastore needs to mounted on all the relevant ESX hosts on the target side V-Center.
11. Similarly, the same datastore will need to be un-mounted on all the ESX hosts on the Source side but no need to remove the VM from inventory.
Select the datastore -> go to hosts tab you should see no of hosts under this column to confirm datastore is un-mounted from all ESXi hosts.
12. After all need to swap the personality of datastore and make LONDON2 site as primary and data sync from LONDON2 to LONDON1 as VM is now active in LONDON2 datacenter.
I guess outlined step by step procedure how to failover Virtual Machine in VMware. Almost this is helpful only in case of PRODUCTION systems with capability of DR configured as business continuity configured as it involves cost and have overhead of network bandwidth for data sync from PROD to DR. This article will be helpful to clear the understanding for SA performing failover task.
Please get in touch in case of any clarification .