Migrate VPS
VPS migration is performed by the vps-migrate.pl script that moves VPS(s) to another host. This script uses:
- OpenSSH client:
for secure copying (scp remote file copy program)for executing commands on a remote machine
- tar archiving utility.
To perform a migration, access to remote servers and logging into them automatically without entering the password each time is required from the "source" box. So, the access keys should be copied from the "source" box into the destination box. If such keys are not uploaded, the script does it for you (use the --put-ssh-key option).
Preparation:
- Suspend the VPS server on the "source" box.
- Configure the destination machine to be VPS server host:
- Install all required packages (FreeVPS kernel, FreeVPS tools, Parallels H-Sphere VPS scripts).
- Complete all configuration tasks.
Actions performed by the script:
- The remote host VPS servers configuration is loaded and checked
- Platform compatibility is checked for the VPS box and the destination host. For example, a VPS under Enterprise Linux can't be moved to a host under RedHat Linux release 7.3.
- The script checks whether a VPS with the same name as the migrated one exists on the destination box
- Available free disk space on the destination host VPS home partition is checked as
Free_space > VPS_disk_usage*1.5 - The script checks if the VPS server virtual context number exists on the destination box:
- if the migrated VPS server virtual context does not exist on the destination box, the VPS is created with this context
- if it does exist, the first free virtual context is used for the migrated VPS
- Network interface which all the virtual network interfaces were attached to is checked. If a network interface does not exist on the destination host, new one is used, and the VPS network is reconfigured to be used to assign virtual network interfaces.
- VPS home is archived using the tar utility filtered through gzip
- MD5SUM for the source file is compared with that of the file copied to the remote host
- VPS traffic data is migrated to the destination box
- Post-migration:
- configuration quota check) is restored within 3 minutes by the
crpn/vps-cron-fix.pl cron - Migrated VPS is suspended on the destination box, and should be resumed via Parallels H-Sphere or manually.
For help, run:
# ./vps-migrate.pl --help
vps-migrate.pl # Moves VPS(s) to another host.
Usage:
vps-migrate.pl --host=<host> [--user=<name>] --vps=v<ps_name>|--all [--put-ssh-key] [--help]
--host # <host> - host (DNS name/IP address) to migrate VPS(s) to.
--user # <name> - username to be used to log into the host.
# If username is not specified, the name of the user executing the script will be taken.
--vps # <vps_name> - VPS to be migrated.
--all # Migrate all known VPSs.
--put-ssh-key # Generate and upload public SSH keys to remote box.
--help # Print this help information.