Migrating your Linux server from the Rackspace US Cloud to the UK
We here at Fuzzy Orange love the Cloud. We make extensive use of cloud services, particularly at Rackspace. When we started running cloud servers at Rackspace they only offered this service in the US but now it's offered in the UK too and we're migrating our servers over.
Rackspace have provided a detailed set of instructions which do the job well, but are maybe not the best at explaining what's going on. There are also one or two little "gotchas" not mentioned there.
Now, the first thing that should be noted is that depending on the complexity of the setup on your US cloud server it may be easier to just move files by hand. For example, if you just have a little web server with static content, it would be quicker and easier just to create a new UK cloud server and copy your content across manually.
Important things you need to know
1. US and UK usernames and API keys
The Rackspace migration scripts use the Cloud Files API to copy things around, so you will need valid usernames and API keys for both the US and UK cloud.
2. US and UK servers will run simultaneously
You need to have both servers up and running for the whole procedure, so you will be charged for both until everything is complete.
3. Python 2.6 on your UK server
Older Linux distributions ship with Python 2.4, which isn't good enough to run the Rackspace migration scripts. If you're so inclined you can build Python 2.6 from scratch, but it's easier to grab the ActiveState Python 2.6 installer and use that.
4. Files can't be changed during the process
Well, they can, but you'll have to transfer any changed files manually after the process is complete. When taking the source snapshot of your US cloud server you have to make sure no files are open for writing - this means databases either shut down or open read-only.
5. It will take about a day for this to complete
After you've created your migration image and run the Rackspace migration scripts you need to create a support ticket wait for Rackspace to do some work behind the scenes to link your US image to your UK server. It will take about a day or so for this to happen.
Step by step
1. Create the destination server in the UK cloud
Create a new, blank server in the UK cloud. Make sure it matches exactly your US server for memory, disk size and OS version.
2. Create an on-demand backup on the UK server
This is where the US image is eventually copied across to. Call this something like "MigrationImage" so you'll know what it's for.
Once it's complete, go to Cloud Files and look inside the cloudservers folder. Take note of the .yml file for your image for later (e.g. MigrationImage_20110607_123456.yml)
3. Prepare the US server
You need to prepare the server for an on-demand backup image. This means making sure no files are opened for writing, which means any databases need to be shut down or set to read-only.
4. Create an on-demand backup on the US server
This becomes the source image for your UK server. Call this something like "MigrationImageSource" so you'll know what it's from
Once you have the on-demand backup of the US server you can optionally restart your databases or make them read-write again, but understand that changes from this point on won't be copied by the migration scripts so you will have to deal with them manually afterwards.
Just like the UK image, go to Cloud Files and take note of the name of the .yml file for use later.
5. InstallPython 2.6 on your UK server
Check the version of Python you have installed by just running "python --version". If don't have Python installed at all, try to install it using your system's package manager (e.g. "yum install python" or "apt-get install python")
If you don't have at least Python 2.6.0 then you'll need to install it by hand. You can download the source and compile from scratch, but as you're probably only going to be using it this once for the migration, you might find the ActivePython from ActiveState easier to install - just remember to add the ActivePython bin directory to the beginning of $PATH once you're done.
6. Install PyYAML on your UK server
PyYAML is a Python module the migration scripts need to run. Download it from http://pyyaml.org/download/pyyaml/PyYAML-3.09.tar.gz, untar it to a folder and run "python setup.py install" to install it.
7. Download the migration script on your UK server
Get the Rackspace migration script from http://c857.r57.cf3.rackcdn.com/migrationscript_v1.0.zip and, if you like (and I'd recommend that you do so), verify the checksum with that on the Rackspace FAQ page. Unzip the file into a folder.
8. Run the migration script on your UK server
Now you need to run the command on your UK server to copy the migration image over from the US to the UK. The format of the command is :
You need to replace US_username, US_apikey, source.yml, UK_username and UK_apikey with your details so the command ends up looking like :python cpp.py -i -v usaccount:rapovn09202v97vouovn29v2v1@cloudservers/MigrationImage_20110607_123456.yml ukaccount:99hiefoid90ouopbv2poxcox89@cloudservers/
This will take a while to run depending on the size of the image to be migrated. It will print progress as it goes. Don't worry about getting it wrong, it handles errors gracefully and you can run it again. If you have an exceptionally large server image it may be worth running this inside Screen or some other tool that allows you to disconnect from the session without terminating your login.
9. Raise a support ticket in the UK portal
Once the migration script has completed you have to raise a support ticket in the UK cloud portal. The Rackspace FAQ has the correct wording to use in the ticket details, but additionally I would suggest you add the name of the US and UK servers.
10. Restore the migrated image to the UK server
Once you have notification from Rackspace support that they have finished migrating your image you should be able to restore the image to your UK server. The migration overwrites the on-demand UK backup you took at the start of all this with the US on-demand image, so restore using that.
Once this is done the UK server is now an identical copy of the US server at the point the on-demand image was taken there.
11. Change network settings on the UK server
Sometimes this happens automatically, but sometimes it doesn't. If you can't immediately access your UK server on the new IP address it has been assigned, you'll need to use the Cloud console to connect to it directly to change the network settings.
The Cloud portal already gives you the primary IP of your cloud server. Rackspace support assure me that for all cloud servers the netmask is always 255.255.255.0 and the default gateway is the same as the IP, but with the last octet changed to 1 - so, if your primary IP is 18.104.22.168, your default gateway is 22.214.171.124. DNS servers should be 126.96.36.199 and 188.8.131.52.
12. Test your UK server
Now you need to test the new UK server to make sure it's all working. Start any databases you had previously stopped or bring them out of read-only mode.
13. Sync up any changed content
If any content has changed on the US server since you started this process then this is the time to copy it across to the new UK server.
14. Change DNS names to point at UK server
If you have any public DNS records that refer to the US server you probably want to change them now to point at the new UK server.
15. Delete the US server
Once you are totally, 100% sure that the UK server has migrated correctly, all content has been copied and any DNS entries have been re-pointed towards it, you can delete your US server.
Remember that you are still charged even if your US server is switched off, so you need to delete it entirely. If desired, create an on-demand backup to Cloud Files before doing so you can re-create it if necessary.And there you go - your US cloud server is now running in the UK.