Categories
How-To Sys Admin

MySQL Replication on Ubuntu with DRBD

I’ve been looking around for some easy and open-source ways to handle database replication for a handful of small but important MySQL databases. A few options were viable but usually included too many config changes for things like creating a new database. DRDB on a Linux server seems to be one of the fastest and easiest methods to handle database synchronisation for DR purposes, so this is the subject of this post. The content is a combination of two main sources from Mark Schoonover and the Ubuntu server guide and the gotchas I found along the way.

This post will show you how to create two MySQL servers that automatically replicate all their databases using DRBD. With Heartbeat installed on a third machine you’ll have basic fail over protection as well (we’ll do this in another post). Only one of the database servers will be active at any one time.

Categories
Sys Admin

Upgrading to VMware Server 2 on Ubuntu 8.04

After downloading the latest Windows 7 RC I loaded it into VMware Server 1.06 that I installed on Ubuntu Server a while back. All going well until the Windows 7 installer wouldn’t see the disk I had created. It seems that Windows 7 doesn’t like the SCSI virtual disk, so I removed that and created an IDE virtual disk and restarted the install.

Things were much better until it came time to install the VMware Tools and nothing happened. Things weren’t exactly snappy and without the tools installed, they weren’t going to get any better. It was time to make the upgrade from VMware 1.06 to 2.0 and as it turns out, is much easier than previous VMware installs.

Overall I followed the instructions from the LinuxGazette website and things worked flawlessly, but there were a couple of extras due to the upgrade.

Firstly (and fairly obviously), make sure you stop your current VMware daemon/service before starting the install. The VMware installer is pretty good, but I’m sure that your virtual machines would appreciate being offline before things get messed up.

sudo /etc/init.d/vmware stop

If you’re upgrading from VMware Server 1.06 the installer will also complain about the vmnet and vmmon modules being left from a previous version. So we need to get rid of those – using the correct kernel version. You can get that with “uname -r”.

sudo rm /lib/modules/2.6.24-22-server/misc/vmnet.o
sudo rm /lib/modules/2.6.24-22-server/misc/vmnet.ko
sudo rm /lib/modules/2.6.24-22-server/misc/vmmon.o
sudo rm /lib/modules/2.6.24-22-server/misc/vmmon.ko

After that it’s plain sailing. Just follow the instructions to untar your VMware download and run the installer. Assuming you used the default locations in the previous install, your virtual machines will be untouched and start happily under VMware Server 2.0

One of the final things to note in the install is that the new client interface is all browser based. To log into your VMware server requires a password and the Ubuntu root user does not have one by default. So on your server be sure to run,

sudo passwd root

and set a nice secure password for when you head to http://servername:8222. Firefox users will need to give the site security certificate the OK and all browsers will need to install the plugin to use the console to view your machines.

Hooray – Windows 7 now installs the VMware Tools properly and runs pretty well. At the moment I have no sound and the limited graphics under VMware don’t allow Aero fanciness, but I can now test and develop in the Windows world while meeting all license requirements. The Windows 7 RC license is valid until June 2010 although don’t wait that long as it’ll start making life hard for you in March 2010. That’s almost a year of free OS from Microsoft!

Categories
Interesting Stuff Sys Admin

Enable WakeUp from PS2 Keyboard in Ubuntu 8.10

One of the annoying “missing features” I’ve struggled with under Ubuntu is that I was unable to wakeup the PC from suspend or hibernate with my keyboard. Of course, Windows just does it – tap the keyboard and the PC starts up again. I could press the power button on the front of the PC, but its down the side of the desk and not easily accessible.

I found an older post in the Ubuntu forums that had the fix for USB devices and it also works for PS2 with the simplest of changes. So follow these steps and you should be saving power and getting back to work faster.

Open a Terminal and type,

cat /proc/acpi/wakeup

Note the entries that come back and you should see a device called “PS2K” toward the top if you have a PS2 keyboard. For those with USB, it’ll be one of the USB items toward the bottom. The entry will probably also have “Disabled” on the same line, hence your problem.

To enable this entry, switch to a root session by typing,

sudo -s

and enter your password. Now type the following to update the acpi file and toggle “disabled” to “enabled”, (those with USB devices can try USB0, USB1, etc)

echo PS2K > /proc/acpi/wakeup

That should have now enabled your PS2 keyboard to wakeup your PC for this session. Give it a test by putting your machine to sleep and then tapping a key on your keyboard. Probably a good idea to save stuff first, just in case.

If you tried changing a USB device, it may take a few guesses until you find the KB. My mouse was USB0 and clicking any mouse button can also do the wakeup task.

To make this change permanant, you need to add that line to a script and run it when Ubuntu starts. So we create a file called wakeup.sh with the following contents,

#!/bin/bash
echo PS2K > /proc/acpi/wakeup

Save it and from a Terminal make it executable so it runs properly as a script and not just a text file,

chmod +x wakeup.sh

Now to add it to the startup area go back to your Terminal that’s running as root. We need to copy the file to the correct location and add it to the startup processes. You’ll need to run the cp command in the same folder as where you saved your wakeup.sh file.

cp wakeup.sh /etc/init.d/wakeup.sh
update-rc.d wakeup.sh defaults

Now when you reboot, the script will run and enable your PS2 keyboard in ACPI so you can wakeup your PC.

Categories
Interesting Stuff Sys Admin

Installing VMware Server 1.06 on Linux

Installing the free VMware Server is a common but slightly tricky process on some newer Linux systems. Having had to go through it again recently I thought I’d write some of it down. Of course if you are using Ubuntu 7.10 then the simple option is to enable the Canonical Partner repository and just use Synaptic to select and install VMware Server.

For the others in the audience that are installing on Ubuntu 8.04 or another Linux system that doesn’t have packages, you should have a working VMware Server install with web interface and a client console by the bottom of the page.