Going Dedicated for Global Affiliate Network

October 7, 2009

This is an exciting time for Global Affiliate Network – just 4 months after the official launch, there is already far too much traffic for the shared hosting plan we started with, so it’s time to make the move to a dedicated server.  In itself, that’s no big deal – the trick is in making that switch with the minimum interruption to service – we have leads flowing in all the time, so we really don’t want to lose any more traffic than we have to!  This entry will journal the steps I take to make that move…

Setting things up

At this point, the dedicated server is all setup with Apache, PHP and MySQL.  Further, I have already frozen the code on the old server and uploaded a copy to the new.  New databases have been created and loaded with a snapshot copy of the data from the old server.  Then the system has been tested out and any configuration changes (database server settings, etc) updated and checked.  It’s tough to check EVERYTHING, but if you’re not changing the code, then things tend to work as they always have or to fall over horribly – there’s not really any middle ground!

Right now – the new databases are empty and waiting.  Most of our traffic is UK based, so the upgrade is going to happen around 8pm Central, which is the early hours UK time, so therefore low traffic volumes.  Time to make the switch!

Making the switch

Letting the users know

About two days ago, we put out a notice that this upgrade was about to happen.  It’s amazing how upset some users can become at any interruption to service, no matter what the reason – so some advance warning is always a good idea and emphasizing the benefits to come.  Then tonight a 30 minute warning was sent out – loss of service should be short, but it never hurts to keep people informed.  I’m not going to be answering support desk tickets during this transition anyway…

Locking down the old system

We need to freeze the database as much as possible to make this switch.  It’s a MySQL database, so there will be some time while we download the old data and upload it to the new databases.  Old data will remain on the original server for the time being as a backup while we check out the new setup, but it will become increasingly out of date with each lead that passes through, so we need to get the new system working asap.

  1. Switch the domain name over to the new server.  The old server no longer functions, so the sooner you start propagating the new server IP address, the better!
  2. Change the database passwords in the old config files to “break” the website – that prevents any changes to the data from routine usage.
  3. Download the MySQL databases (one for the email list, one for all our leads) as SQL files.
  4. Setup a single, root directory .htaccess file to give a 301 redirect to the new server – shouldn’t be needed for long, but better than leaving visitors just hanging there.  It’s not ideal to redirect all traffic to one single page, but this is only while the new domain name settings propagate (probably 72 hours max, and usually a LOT quicker than that).  The file will need to include the line:

    redirect 301 /old/old.htm http://www.you.com/new.htm

Loading up the new system

With the above changes, the new system is already up and running – it just doesn’t have any data in it!  So as soon as we get the exported data uploaded, we should be in business…  Now, with databases of this size, phpmysqladmin is not going to handle it – you just cannot upload files this big, so it’s time to go command line!

  1. Upload the exported files from above to the new server – put them somewhere you will be able to find them easily!
  2. SSH into the new server.
  3. Log in to mysql using mysql -u USERNAME -p – it will prompt you for your password
  4. Select the database you want with source DATABASE
  5. Upload the data with source /path/to/DATAFILE
  6. Rinse and repeat for the other database

Now – if you’ve prepared everything correctly – that should be that!!


One Response to “Going Dedicated for Global Affiliate Network”

  1. Rather good post, very enlightening stuff. Never ever considered I would obtain the tips I would like right here. I’ve been looking throughout the internet for a while now and had been starting to get irritated. Fortunately, I came across your internet site and got precisely what I was looking for.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: