Finally Rackspace are now offering customers the option to use a SQL database cloud this is without doubt exciting news for us speed freaks! What’s more since it is an scheme still in pilot it’s absolutely FREE.
So what are the major benefits of using an SQL on a cloud?
Well there’s absolutely many reason why, so here are just a few major benefits.
- Frees up resources on your vps by removing mysql-server.
- Redundant storage by default on all clouds.
- Clouds are monitored.
- Clouds are scalable with demand.
- Built for performance.
There are more benefits than the ones I've listed a simple Google search or looking on Rackspaces homepage should display many more, but lets move on and find out exactly how you can make use of putting your database onto a cloud.
Using Rackspace’s SQL Database Cloud Guide
This guild is split into 7 steps, if you have a questions or encounter any problems please don’t hesitate to ask using our comment system found at the bottom of this page.
Step 1 - Rackspace Server Backup
Before we proceed please ensure that you either have a backup of your server which is current either by a daily scheduled backup or an on-demand backup. Making a backup could not be any simpler on Rackspace, I’m sure you know already but if you forgot using the 1st generation control navigate click:
Hosting > Cloud Servers
Once on this screen click the server you want to backup, you will then see 4 Tabs (Note: it may be different on the US control panel, since I’m using the UK one I can’t say).
The 4 tabs you should see are Overview, DNS, Images and Diagnostics. Click Images, and you should see the following screen.
As you can see from the screenshot above I have daily backups but since I’ve had user comments on the blog if I was to mess up I’d lose all entries up to the point of the daily backup, so In this case it’s best to do an on-demand server backup.
Step 2 - Finding the SQL Cloud Service
In order to see and use the SQL Database Cloud Service by Rackspace you must have digitally signed the terms and conditions of using a server cloud and have the option available to you, if you have only signed the agreement to use a file cloud then the chances are you won’t be able to use an SQL database.
As mentioned before the SQL Cloud is currently free while it’s in Pilot, we have no idea how much this service is going to cost, though I have talked to the guys at Rackspace and they have meetings on going and its planned that the staff get told more information in August.
Below is a screenshot of where you can find the SQL Tab within your 1st Generation Control Panel.
Once there your notice that it needs to launch the SQL control panel in the 2nd Generation Control Panel, personally I prefer the old but hey!
Step 3 - Creating an SQL Instance
Just as you would expect with starting a server instance we need to do exactly the same but this time for an SQL instance. Below is a screenshot of the UK 2nd Generation Control Panel.
The service is free so you can freely use as much ram as you want and space but please note that when this service goes live you will be charged from then onwards, Rackspace have said they will notify all customers of costs in advance. I personally feel that you should use whatever you believe you need this way you can see the true performance gain at the cost you can affordable. Unless you operate a site which has 10,000+ visitors daily, and has 1000’s of articles/pages then it’s very doubtful you need more than 512mb.
Tip: If you’re using some kind of common CMS such as Wordpress, Joomla etc, then I recommend you use the username and password, as well as the database name in your Rackspace settings. By doing this you will only need to change a few lines rather than lots more. If your username and password are a little weak then you could use this chance to strengthen your security.
Step 4 - Dumping your current SQL database
You need to get a current dump of your current SQL database, doing this is simple if you have phpmyadmin and just using the export feature but I’d imagine not everyone has this installed.
If you do not have phpmyadmin installed then login to your server using SSH or the console within your 1st Generation Control Panel within Rackspace. You can find this:
Hosting > Cloud Servers > Your Server Name > Console.
Once you have logged into the terminal using your username and password ensure that you are in your home directory or somewhere you want the SQL file to be made.
To dump the SQL simply type this: mysqldump -u USERNAME -p -r FILETOBESAVED YOURDATABASENAME
It should prompt you for your password for that database, once you provided a valid password it’ll extract the SQL database and dump it into the file to be saved file name, confirm it’s saved by doing an ls within the terminal. If you see the file has been successful saved you can move onto the next step.
Step 5 - Importing your SQL file to Rackspace’s SQL Cloud
Sadly as of yet the SQL cloud on Rackspaces 2nd generation control panel does not have an import feature, I hope this is just something they haven’t got around to yet since not having it requires more work. To import your dump file were going to login to your MySQL which is running on their cloud setup.
To do so you will need to find out the address it is operating for, for security reasons I’m not going to show a screenshot of the control panel of my setup but to find out the IP address you need to navigate to your 2nd generation control panel > Cloud Databases > Instance Name > Copy Hostname into the clipboard.
So you should have something like somethinglong.rackspaceclouddb.com, once you have this saved into the clipboard or a text file we can import your SQL database to Rackspaces Data Cloud, this is pretty straight forward. You will need to know the username and password, as well as the database name you made on the cloud at Rackspace, so have this text document open if you copied it.
In the terminal do:
mysql -u YOURUSERNAME -p -h somethinglong.rackspaceclouddb.com DUMPFILENAME
This will prompt you to enter password, and if you don’t get any errors it’s worked.
Step 6 – Use Rackspace’s Database Cloud for CMS
Using the Database Cloud for your CMS such as WordPress and Joomla etc, is pretty straight forward you just need to update your configuration file, change localhost to somethinglong.rackspaceclouddb.com and enter new username and password in the event you reset these, you should not have to change the prefix.
Simply load up your browser and see if your site is accessible, if it works then your site is reading SQL from the CLOUD! Congrats! And welcome to the fast SQL club. In the event it’s not then I guess something went wrong, feel free to add comments at the bottom and I’ll try and help when I can.
If you want to free up resources on your VPS cloud then move onto the next step.
Step 7 - Freeing Up Resources by Removing MySQL-Server (Optional Step)
This step is completely option and I only recommend it if you’re not too worried about Rackspace’s pricing when it comes into effect. Since you now have your Database on the Cloud there’s little point in using MySQL-Server running on your VPS. This ultimately will free up resources and should make your VPS run faster.
Removing MySQL-Server is easy on Ubuntu just use sudo apt-get remove mysql-server, do not remove mysql-common or php5-mysql as these are required to read databases period.