Difference between revisions of "Ovz container live migration"

From vpsget wiki
Jump to: navigation, search
Line 21: Line 21:
 
  vzmigrate --live --ssh="-p 7822" 192.168.1.1 892
 
  vzmigrate --live --ssh="-p 7822" 192.168.1.1 892
  
You may keep original CT on the source node for backup or any other purposes (this will remove CT config file but keep files), just add -r=no key:
+
You may keep original CT private area (filesystem) on the source node for backup or any other purposes (this will remove CT config file but keep files), just add -r=no key:
 
  vzmigrate --live --remove-area=no --ssh="-p 7822" 192.168.1.1 892
 
  vzmigrate --live --remove-area=no --ssh="-p 7822" 192.168.1.1 892
  

Revision as of 12:09, 29 January 2016

Here we'll shortly describe how to migrate container from one node to another.

using openvz and solusvm CP.

For more details please refer to the next links:

http://docs.solusvm.com/migrating_openvz_containers

https://openvz.org/Migration_from_one_HN_to_another


We are assuming that the ssh keys are already configured.

you need to find the container ID. you can find it by name or by ip. For example let's find it by ip:

vzlist -a | grep <IP>

After that we can use vzmigrate with --live option to make migration w/o container stops:

vzmigrate --live --ssh="-p <port_number>" <destination_node_ip> <container_ID>

Example:

vzmigrate --live --ssh="-p 7822" 192.168.1.1 892

You may keep original CT private area (filesystem) on the source node for backup or any other purposes (this will remove CT config file but keep files), just add -r=no key:

vzmigrate --live --remove-area=no --ssh="-p 7822" 192.168.1.1 892

Note if you are using differ ssh port please change it. if you are using standart ssh port - you can simply remove ssh section from the current command.

You may add --nodeps in case you get any dependency problems:

vzmigrate --live --ssh="-p 7822" 192.168.1.1 892 --nodeps

You will see output :

Starting live migration of CT 892 to 192.168.1.1
Preparing remote node
Initializing remote quota
Syncing private
Live migrating container...
Syncing 2nd level quota
Cleaning up

After that you will need to update your SolusVM master so it knows where the VPS has been moved to:

/scripts/vm-migrate [VSERVERID] [NEWNODEID]

RUN this command on the SolusVM master server!

Example:

/scripts/vm-migrate 885 2
 Virtual server information updated!

Please NOTE: container ID (CTID) and VSERVERID are differ (in most cases) to get VSERVERID you should simply take a look on it in SolusVM CP or in WHMCS panel or from solusvm database:

select vserverid from vservers where ctid=892;


As you can see in our example the VSERVERID and container_ID are differ.



""