Ovz container live migration

From vpsget wiki
Jump to: navigation, search

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.

Use --check-only, --dry-run keys to do not perform actual migration. this will only test that container could be migrated. "Emulate migration"

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


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.


If you receive vzquota related error, check

cat /proc/vz/vzquota

in case you CTI present in list try to :

vzquota off [CTID]
vzquota drop [CTID]

IN case this no help you need to restart VM and drop quota:

vzctl stop [CTID]
 #vzctl umount [CTID] #optional for some cases
vzquota off [CTID]
vzquota drop [CTID]
vzquota show [CTID]
vzctl start [CTID]


If you other having problems with migration. Try to make it not live, try to use -v for verbose debug and also remember to check remote node logs, not only source.


""