Pages

Friday, October 4, 2013

Moving OpenVZ virtual servers around your SolusVM cluster


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, do:

Step1.
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 = the ip of the node you want to transfer the virtual server to.
destination_node_port = the SSH port of the node you want to transfer the virtual server to.


Step2.
Now you need to know the container id you want to move, you can get this by doing the following on the node that contains the virtual server:
vzlist -a

Step3.

When you know the container id you can start the migration. Do the following on the node that contains the virtual server:
vzmigrate -v --ssh="-p <destination_node_port>" <destination_node_ip> <container_id>

When the restore is complete you need to update SolusVM so it knows where the vps has been moved to.
Step 4.

In SSH on your master do the following:
/scripts/vm-migrate <VSERVERID> <NEWNODEID>
<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

Step5.

Example moving vserverid 150 to node 4:
/scripts/vm-migrate 150 4

Heres some extra flags you can use:
-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.

0 comments:

Post a Comment