How to failover linux virtual machine in vmware

how to failover linux virtual machine in vmware

RSY Digital World Logo

How to failover linux virtual machine in vmware

We are going to discuss step by step procedure how to failover linux virtual machine in vmware from one data center to another in using V-Center.

Let’s say the data centers are LONDON1 and LONDON2 simultaneously and the virtual machine name is SERVER1. Here Virtual Machine must be of replicated category which only enabled VM capable of a failover as a DR step.

You must have reserved DR IP while DR setup. Just to be aware replicated VM must be active in a single data center at a time. This procedure is more conceptual and must be performed by SA having a 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 a high level of attention. RHEL 6 VM has been considered in this example.

Note: Virtual Machine name remains the same either it works in any datacenter.

Step-by-Step-Procedure how to failover linux virtual machine in vmware

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 the ESX environment.

With datastore name please validate datastore replication status. This you can achieve by Storage Tool in the environment or you can use the 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 the 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 components 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 the 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 in V-center: You need to know how to disable lockdown mode in ESXi

Configuration -> Security Profile -> Lockdown Mode

How to Enable ESX Shell and SSH in ESXi

Configuration -> Security Profile -> Services -> Properties

Above will give you the ability to login to ESX host via SSH. Again login to ESX host using your credentials.

6. Search & Mount Datastore in ESXi

Once you are on the ESX shell, search for related datastore that needs to be mounted and mount it on the target ESX host.

# esxcfg-volume -l | grep -i <DATASTORE_NAME>

7. How to mount datastore in ESXi

# esxcfg-volume -M <DATASTORE_NAME>

8. How to Scan Datastore in ESXi

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 the application team to validate application in the DR site and create if any alias pointing to target IP. If all looks good from the application perspective and confirms to stay at the DR site only.In that case, datastore needs to mount 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 the 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 the capability of DR configured as business continuity configured as it involves cost and has the 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 regarding process mentioned above. That,s it related to how to failover linux virtual machine in vmware.