faris wrote:
Kalimari, what do you do about site/user settings (e.g. email accounts/passwords, database users/passwords) if you use file copying as opposed to Plesk's migration manager or a backup/restore?
As faris highlighted, focus on a single domain transfer at a time. Never installed or used the migration manager, so the following is something I got used to years ago (before using Plesk) and I stick with it as it works well, every time, with no surprises.
1. Set-up domain (aliases/sub-domains) on new server with same ftp credentials.
2. Set-up database(s) on new server with same credentials.
3. Set-up mail accounts/aliases on new server (but switch off mail service initially).
4. gzip the contents of httpdocs on old server and scp transfer to new server and gunzip into httpdocs.
5. For e-commerce websites redirect all traffic to holding page on old server (to avoid duplicate order ids), not as essential for other CMS websites.
6. Dump database(s) and scp to new server and import.
7. Enable mail service on new server and switch off mail on old server or set forward to an alternate address, to ensure same server domain e-mail is delivered.
DNS changes can be made prior to this starting or after (depending upon the speed and nature of the change). Use third-party, external DNS and bring the TTL values down just prior to changes to shorten the transfer time (for the rest of world). Switching DNS provider on router or PC Network/DNS settings picks up new change almost immediately (for me/client).
Use a sub-domain on my domain per (important) website hosted for development purposes, which comes in very handy as it also allows an exiting website to be transferred and tested in new environment prior to full domain transfer.
Some useful commands:
Code:
/* list FTP accounts */
SELECT REPLACE( sys_users.home, '/var/www/vhosts/', '' ) AS domain, sys_users.login, accounts.password
FROM `sys_users`
LEFT JOIN `accounts` USING( id )
ORDER BY sys_users.home ASC
Code:
/* list mail accounts */
SELECT
CONCAT( mail_name, '@', name ) AS username,
password, name AS domain
FROM `mail`, `domains`, `accounts`
WHERE PASSWORD NOT LIKE '' AND mail.dom_id=domains.id AND mail.account_id=accounts.id
ORDER BY NAME, mail_name ASC
Code:
/* dump databse on old server*/
mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` -c -e --default-character-set=utf8 --skip-set-charset -B DBNAME > DBNAME.sql
/* transfer via scp, files can be gzipped before hand, have a user set-up specially for certificate auth */
scp DBNAME.sql un@newserver:~
/* import database on new server */
mysql -uadmin -p`cat /etc/psa/.psa.shadow` --default-character-set=utf8 DBNAME < DBNAME.sql