Get Virtualizor

Migrating OpenVZ Container

Overview

This article will explain how to migrate your OpenVZ container from any server to a Virtualizor Server.

vzmigrate utility is used to migrate a container from one Hardware Node to another.

Note : This will lead to downtime for avoiding any kind of data loss. Make sure that container with the same id does not exist on the server . If exists, then you will require to change the container id .

Prerequisites

Make sure:

  • 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.

Procedure

This method involves migrating the single container to the Virtualizor server.

Notes:
[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.

Authentication

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] 

vzmigrate usage

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:

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.

Reference link

For more reference you can Visit the below link :- https://openvz.org/Migration_from_one_HN_to_another

Support

If you face any issues, please feel free to email us at support [at] virtualizor [dot] com

    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list