Migrating OpenVZ Containor
This article will explain how to migrate your OpenVZ containor From any server to a Virtualizor Server.
The vzmigrate utlity is used to migrate a container from one Hardware Node to another.
Note : This will lead to downtime for avoiding any kind of data lose. Make sure that container with the same id dose not exist on the server . If exist then you require to change the container id .
- 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
This method involves migrating the single container to the Virtualizor server.
- [Old Server] : This indicates that the command/operation has to be executed on the old server.
- [New Server] : This indicates that the command/operation has to be executed on the new server.
First set old server to authenticate the new server with the ssh keys
First we have to setup SSH to permit the [Old Server] to be able to login to the [New Server] without a password prompt. Run the following on the [Old Server].
- Download the ssh key generation file and set executable permission to it
wget http://mirror.softaculous.com/virtualizor/setsshkey.sh Chmod +x setsshkey.sh
- Run the below command to set ssh keys on both the server
./setsshkey.sh [New Server ip][Port] It will prompt for [New Server] password .
- Once you provide the password the keys will be automatically setup .You can test it by trying to connect from [Old Server] to [New Server] .
Migrate a running container
Here's a simple command to be executed on the [Old Server] that will migrate container to new server.
vzmigrate -v --remove-area yes|no [newserver ip] [CTID]
This program is used for container migration to another node Usage: vzmigrate [-r yes|no] [--ssh=<options>] [--keep-dst] [--online] [-v] destination_address <CTID> Options: -r, --remove-area yes|no Whether to remove container on source HN for successfully migrated container. --ssh=<ssh options> Additional options that will be passed to ssh while establishing connection to destination HN. Please be careful with options passed, DO NOT pass destination hostname. --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 syncing container private area again in case some error (on container stop for example) occurs during first migration attempt. --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).
Import the container to virtualizor
In order to Import an OpenVZ VPS, you can follow the following steps:
The OpenVZ VPS ID's will be listed on the left side. You can select a bandwidth you wish to allow and then select the user for which you wish to import the VPS to. Click import to import the VPS.
For more reference you can Visit the below link :- https://openvz.org/Migration_from_one_HN_to_another
If you face any issues, please feel free to email us at support [at] virtualizor [dot] com