Migrating OpenVZ Containers

This is a quick and easy guide to moving OpenVZ virtual servers around your SolusVM cluster.

On the node that hosts the container you want to migrate:

SSH Terminal:

wget http://files.soluslabs.com/solusvm/scripts/keyput.sh
chmod a+x keyput.sh
./keyput.sh destination_node_ip destination_node_port
  • <destination_node_ip> should be replaced with the IP address of the node you want to migrate the virtual server to
  • <destination_node_port> should be replaced with the SSH port of the node you want to migrate the virtual server to

Now we need to find the container ID of the VPS you want to move. We can find this by running vzlist:

SSH Terminal:

vzlist -a

Find the container ID (CTID) of the VPS you want to move and start the migration using vzmigrate:

SSH Terminal:

vzmigrate -v --ssh="-p destination_node_port" destination_node_ip container_id

When the restore is complete you will need to update your SolusVM master so it knows where the VPS has been moved to. Run the following on your SolusVM Master:

SSH Terminal:

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

 /scripts/vm-migrate 150 4
  • <VSERVERID> is the ID listed in your VM list in SolusVM
  • <NEWNODEID> is the ID of the node listed in your Node List in SolusVM.

There are some other flags you can use with vzmigrate:

-r, --remove-area yes|no
        Whether to remove container on source host after successful migration.

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

--online
        Perform online (zero-downtime) migration: during the migration the
        container freezes for some time and after the migration it
        keeps working as though nothing has happened.

http://docs.solusvm.com/migrating_openvz_containers
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s