Migrate sites from cPanel to Plesk

Login to cPanel server and generate an SSH key. Run the following command in the terminal to generate the key.

ssh-keygen -b 2048 -t dsa -N “” -f /root/.ssh/id_dsa

The above command will write the key to the file /root/.ssh/id_dsa. Now login to the Plesk server and add the key into the file /root/.ssh/authorized_hosts. This will setup an SSH connection between the servers and you can now run rsync commands to migrate data over remote server.

Steps for cPanel to Plesk migration

1) Create an account in Plesk server. Also note down the DocumentRoot of the domain. By default, it would be /var/www/vhosts/domainname/httpdocs

2) Migrate files.

Run the below command from cPanel server

rsync -az –numeric-ids –progress /home/username/public_html root@$remote_ip:/var/www/vhosts/domainname/httpdocs

3) Migrate Databases.

– Take dumps of all databases using the below command.

mysqldump database_name>database_name.sql

– Copy the dump files to remote server.

scp database_name.sql root@Remote_IP:/var/www/vhosts/domainname/

– Login to plesk server and restore all databases.

mysqldump database_name<database_name.sql

4) Migrate email accounts.

– Setup email accounts on plesk server. Their default mail location will be /var/qmail/mailnames/example.com/username/Maildir. Now copy all mails using the below command.

rsync -az –numeric-ids –progress /home/username/mail/example.com/username root@$remote_ip:/var/qmail/mailnames/example.com/username/Maildir

Advertisements

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