Saturday, 12 March 2016

VPS Migration OpenVZ


LIVE/ONLINE MIGRATION:
------------------------------------

Here,
    I have two HW nodes running OpenVZ as S1.ROOTUSER.IN (192.168.0.10) AND S2.ROOTUSER.IN (192.168.0.100). We will migrate running/live container vps.rootuser.in [1001] from S1.ROOTUSER.IN to S2.ROOTUSER.IN with no downtime.

BEFORE MIGRATION:

    * You have at least one good backup of the virtual machine you intend to migrate.
    * rsync is installed on the target host.
    * In general you cannot migrate from bigger kernel versions to smaller ones.
   
1. ENABLE PASSWORDLESS LOGIN TO S2.ROOTUSER.IN FROM S1.ROOTUSER.IN.
   
    Click Here For Password Less Login With SSH

Now, Login remotely with putty to VPS vps.rootuser.in and continiously ping google.com to make sure that the VPS is live/online while migration.

 vps~]# ssh root@vps.rootuser.in
 vps~]# ping google.com

3. LOGIN TO S1.ROOTUSER.IN(source) AND START MIGRATION:

  S1~]# vzlist
     VEID      NPROC STATUS  IP_ADDR         HOSTNAME
         1001          9 running 202.52.134.143  vps.rootuser.in

  S1~]# vzmigrate --online -r no --keep-dst -v 192.168.0.100 1001

Now you can check status with below command.

  S1~]# ps -aufx | grep vzmigrate
  S1~]# w

4. After migration take a look at -

  S1~]# # vzlist
     VEID      NPROC STATUS  IP_ADDR         HOSTNAME

  S2~]## vzlist
     VEID      NPROC STATUS  IP_ADDR         HOSTNAME
      1001         34 running 202.52.134.143  vps.rootuser.in

PARAMETERS FOR vzmigrate COMMAND:

--r (yes|no)     Whether to remove container on source HN for successfully migrated container. By default 'yes' (remove) enabled.
--online     Perform online (zero-downtime) migration: during the migration the container hangs for a while and after the migration it continues working as though nothing has happened.
-v        Verbose mode. Causes vzmigrate to print debugging messages about its progress (including some time statistics).
--keep-dst     Do not clean synced destination container private area in case of some error. It makes sense to use this option on big container migration to avoid re-syncing container private area in case some error (on container stop for example) occurs during first migration attempt.

NOTE: For simple migration, just remove --online parameter from the above command.





Thats it...

#<A HREF="#top">Top</a>

No comments: