Migrating a site from another server

From Edgar BV Wiki
Jump to navigation Jump to search
Migrating from server A -> B 

Prepare for the migration:
On A have a virtualhost temp.origdomain.ext
On A have a virtualhost original.origdomain.ext
On B have a virtualhost temp2.edgarbv.com
On B have a virtualhost original.origdomain.ext

On temp.origdomain.ext add the following to the virtualhost directives:

RewriteEngine On
RewriteRule ^/(.*) http://temp2.edgarbv.com/$1 [L,R]

And reload the webserver. Then get the domain administrator to change the A record of temp.origdomain.ext to point to server B.

After 2 days, all temp.origdomain.ext should be flowing to temp2.edgarbv.com. This virtualhost should point to the same DocumentRoot as original.origdomain.ext on server B.

On Server A, add the following to original.origdomain.ext

RewriteEngine On
RewriteRule ^/(.*) http://temp.origdomain.ext/$1 [L,R]

And again reload the webserver. Now all traffic that hasn't got the new A record will be chained to temp2.edgarbv.com (which shouldn't be much traffic after 2 days) and the rest will go directly to the new machine.

Now all the remaining domain names in temp.origdomain.ext can have their SOA files edited so that they point to server B. Visitors with the old SOA information will be chained through, visitors with the new SOA information will be chained through to temp.origdomain.ext.
# framework rsync
cd /home/sites/www.somedom.com/live/
rsync -a ./ -e ssh morein@82.94.91.78:/home/sites/www.somedom.com/site/live/ --exclude-from=rsyncexclusion --stats -h -v

# logs
cd /home/sites/www.somedom.nl/logs/

# processed stats
/home/sites/server.edgarbv.com/site/sitestats/www.somedom.nl
/var/log/apache2/awstats/*somedom*

# databases