January 2011 Archives

A pseudo Windows sudo

Often when using the command prompt in Windows Vista and Windows 7 you'll need to run the command as an Administrator and whilst running a command prompt elevated is not tough, it's fiddly. If you've forgotten to do it before you've moved your way around the file system it can be very annoying.

Linux has sudo but Windows has no alternative, so we knocked together a very simple sudo for Windows.
To use it, you'll currently need Visual Studio 2010 to compile, then place it in System32 (or any PATH folder) and simply type:
sudo <your-command> <arguments>
To run a permanently elevated command prompt, you can simply type "sudo cmd" into your start bar search and save yourself the additional mouse clicks required to do this the traditional way.

The code is available on our GitHub. There is a pre-compiled binary available, but check your dependencies first.
Before embarking on a MySQL Cluster installation, it is important to remember that MySQL Cluster is 'just' a storage engine for your existing MySQL database servers.  It stores data at the table level, not the whole database, it is therefore on the same functional level as MyISAM or INNODB.  You still need a standard MySQL server to access the table data and store the database information.  This has the fringe benefit that you can target specific tables to be saved to the cluster, rather than the whole database, if you have some tables that are either more important, or more heavily used.

In this article we are going to cover MySQL Cluster, it's installation on Debian (Lenny), Master-Master replication and how to tie all this together with HAProxy for a very high availability solution.
NB: At present you cannot request or share additional internal IP addresses with Rackspace Cloud, so you are going to have to use the external addresses.  With large databases this will incur additional bandwidth charges, be sure to evaluate this additional cost against the benefits provided by high availability.  When Rackspace allow the allocation of additional internal IPs, this article will be updated to reflect that.

Through two related tools and some cheap Rackspace Cloud servers, you can provide a front-end for your database that will balance between multiple replicated database servers and automatically failover if one of your balancers develops a fault.

This article will cover setting up heartbeat and pacemaker to handle the transfer of an IP from one machine to another on a failure and then another install of HAProxy on both boxes to balance the load between your database servers and cope with either of them failing.