In Virtuozzo, we can migrate a VPS from one hardware node to another using “vzmigrate” command. The migration will also include the IP addresses so you do not have to go back and re-add them. We may need to clear the arp cache for the IP to begin routing to the new network device. If you are stopping the VPS prior to the migration then arp cache should not be a problem. I am taking VZNodeA and VZNodeB for reference and migrating a VPS from VZNodeA to VZNodeB.
Before migrating a VPS, we need to make sure that the VPS templates are available on the destination too. On the old VPS node normal vz templates are deployed but the new Nodes have eztemplates deployed. Difference between these two can be read at http://kb.parallels.com/en/1056.
For normal templates ‘vzpkgls’ command and for eztemplates ‘vzpkg’ command is used. e.g
Normal VZ template:
[root@VZNodeA ~]# vzpkgls 115
centos-4 20060323
devel-ce4 20060323
To check available normal VZ templates on the Node, run ‘vzpkgls’.
VZ eztemplate:
[root@VZNodeA ~]# vzpkg list 103
centos-5-x86_64 2008-08-11 19:01:08
To check available VZ eztemplates on the Node, run ‘vzpkg list’.
If the templates are not available then you can either migrate the templates to destination node or choose any other Node. For migration, please refer to the article <b>How to migrate VPS template</b>. Once you confirm that the templates are available on the destination node, next step is to find out the VEID of the VPS that we have to migrate. We can check the VEID by running ‘vzlist’ (-a flag will show the stopped VPSs too):e.g :
[root@VZNodeA ~]# vzlist -a | grep vps.migrationtest.com
VEID NPROC STATUS IP_ADDR HOSTNAME
1200 70 running 10.10.10.10 vps.migrationtest.com
You can migrate the VPS in stop or in running state:
VPS Migration in stop state:
You can stop the VPS by ‘vzctl stop VEID’ in this case ‘vzctl stop 1200′
To start the migration process, run it from the command line on ’source’ server i.e VZNodeA:
# vzmigrate -r no -s root@<dest_ip> <VEID>[:<NEW_VEID>]
-r no means don’t remove VE from source server – ie. if you want to start it on source, just rename <VEID>.conf.migrated to <VEID>.conf (in /etc/sysconfig/vz-scripts directory) and use ‘vzctl start <VEID>
-s means don’t start VE on destination – as I understand network address will change, so there’s no point in starting VE
<dest_ip> – IP address of your destination box in another location.
<VEID> – numeric ID of VE you wish to migrate [:<NEW_VE_ID>] -> optional, if on destination you want to use different ID
for example we are migrating a VPS “vps.migrationtest.com” with VEID 1200 from VZNodeA to VZNodeB (IP off 10.20.30.40) , then
# vzmigrate -r no -s root@10.20.30.40 1200
NOTE: Before running vzmifgrate make sure that a VPS with same VEID doesn’t exist on the destination hardware node i.e In our case VZNodeB and if any VPS with the same VEID exists there then you can change ID of the VPS on destination after it will be migrated:
# vzmigrate -r no -s root@10.20.30.40 1200:2200
The vzmigrate command mentioned above will migrate the VPS 1200 from source node “VZNodeA” to VZNodeB (10.20.30.40) and change its VEID from 1200 to 2200.After the migration is complete, since you use the “-r no” flag, you need to stop the old VPS (or make sure it is still stopped) and then start the new VPS.
VPS Migration in running state:
# vzmigrate -r no –keep-dst -s root@DESTINATION_NODE_IP OLD_VEID:NEW_VEID
in this case:
# vzmigrate -r no –keep-dst -s root@10.20.30.40 1200:2200
NOTE : Please don’t take the VPS transfers like normal shared accounts transfers and make sure that you are not offering transfers to every VPS clients having issues unless there is no other option. For available options, check the man pages for any command.
Leave a Reply
You must be logged in to post a comment.