Federated tables in MySQL

Yesterday at work I had the need to create a federated table in MySQL. I read about the federated engine and thought I had it sussed. I noted:

Beginning with MySQL 5.1.26, the FEDERATED storage engine is not enabled by default in the running server; to enable FEDERATED, you must start the MySQL server binary using the --federated option.

Turns out it’s also possible simply to add the line federated in the [mysqld] section of /etc/my.cnf

The version of MySQL currently installed on my CentOS box was an older one (5.0.45) but I added this line anyway. The server refused to start. It quickly became clear that the MySQL binary packaged with CentOS was not compiled with the federated engine.

Fedora is currently packaging MySQL 5.1.37 but it seems that this too is lacking the federated engine. That’s annoying – I had wanted to install a version of MySQL from some yum repo or other, so I don’t have to keep upgrading the package every time a new version is released.

Perhaps the lack of federated support is a Red Hat (and derivatives) issue. I downloaded the rpm from MySQL directly, and installed it. Guess what – no federated engine compiled in.

So I downloaded the source tarball. I explicitly configured it with the federated engine, like so:

./configure --with-plugins=federated

And then I built and installed it. Nothing worked properly out of the box, and I was annoyed to find that the make install command doesn’t do half of the things I would normally expect it to do. I found this information and followed the steps to get it working. I had to steal and tweak the /etc/init.d/mysqld script from a different box which was running the bog-standard CentOS package.

Woohoo! The federated engine was finally available.

mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | YES     | Federated MySQL storage engine                                 | NO           | NO   | NO         |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.00 sec)

But I can’t understand why none of the binary builds of MySQL include it. Fair enough that isn’t enabled by default in the running server – it’s no problem to add a line to my.cnf on a standard CentOS box. But it is a nuisance to have to build from source. It doesn’t break anything to have it enabled in a build, even if unused.

Of course CentOS won’t change the way they build their packages until Red Hat does. So I’m doing what I can, and I have filed a feature request with Fedora in the hope that in the next major release, there will be a version of MySQL built with the federated engine.

Upgrading to an SLR. Perhaps.

So I’ve been playing with my new camera, a 35mm Canon SLR. I rather like it.

For me, film will never win over digital for convenience, but I’ve enjoyed using the SLR so much that I’m strongly considering upgrading my Fuji Finepix S9600 to a digital SLR. Cost aside, there are several disadvantages in upgrading, believe it or not.

Pros Cons
  • Interchangeable lenses
  • Larger sensor
  • Lower noise
  • Optical viewfinder
  • Optical viewfinder [1]
  • Inability to use the LCD for taking photos [2]

[1] It’s handy to have information in an OSD
[2] The S9600 has a really handy flip-out LCD for those awkward shots

So it looks like buying a digital SLR will bring me higher quality photos, albeit at a cost of convenience. Hmm. I’ll have to consider this carefully.

New camera: Canon AE-1 Program

Today I was given a camera by a relative – an unwanted Canon AE-1P.

Canon AE-1 Program
Canon AE-1 Program

It’s my first SLR camera and I’m looking forward to having a play with it. My digital camera, a Fuji S9600 has many of the controls of an SLR without actually being one, so I’m familiar with the concepts.

But film is very different and I haven’t the first clue about it. I’ve never used a proper film camera. As a child my parents gave me disposable 35mm cameras and they were also fairly early adopters of digital photography (starting with a Fuji A201) so there were never 35mm cameras lying around for me to play with. I had to consult the user manual to figure out how to load film into the AE-1P!

After I’ve taken some photos with the AE-1P and had them developed (and begged, borrowed or stolen a film scanner) I’ll post the results on my photo blog if they are any good.

An easy way to generate an iptables config

This is a +1 for Easy Firewall Generator for iptables.

Of course any self-respecting sysadmin should be able to set up iptables, but sometimes starting off can be tricky. So I use the this website, which lets you define the basics using a handful of checkboxes, and it generates a script that configures your computer’s iptables firewall.

It works for single hosts and servers that do NAT, and includes protection against a great many nasties.

Once you have this, it’s then an easy task to hand-configure the result to your heart’s content.

Resetting the BIOS on an EeePC 701

This evening, my other half’s Eee 701 broke.

Whenever she turned it on, the green power LED and blue wireless LED came on, stayed on, and nothing else happened. The screen backlight didn’t come on, no power was supplied to the USB ports and the fan did not start to spin.

I tried the usual fixes – taking the battery out, poking a paperclip in the reset button in the back. This didn’t work.

Next I reset the BIOS. To do this, you need to:

    • Remove the battery and disconnect from the mains
    • Remove the memory cover from the back with a small screwdriver
    • Locate the BIOS contacts. Turn it so the memory chip is at the bottom, and look at the top half (the bit that isn’t covered by the memory chip). The contacts are in the bottom-left corner of this, and they are small copper triangles. I’ve circled them in red in this picture.
The BIOS contacts
  • You need to short-circuit the two small triangular copper contacts with a screwdriver for a second or two.
  • Replace the memory cover and battery, and turn the Eee on again.
  • For me, this worked and it booted normally. Your mileage may vary!

Google calendar

I decided that I need to sort out the way I do my personal calendaring.

Currently I only use my phone’s built-in calendar. I nearly always have my phone with me, but it’s a bit of a pain to enter stuff on when I’m sat at a computer anyway, and carrying all that information solely on my phone presents a huge risk of loss, theft or breakage.

I need some kind of centralised store of information that is able to sync with all the devices and programs I want to use, namely:

  • Some sort of cross-platform calendar client – mainly for use on Linux but also nice to be able to use similar software if I’m on Windows or OS X.
  • Sony-Ericsson P1i (Symbian) built-in calendar
  • iPhone, for when I get one
  • Web interface, for those times when I’m borrowing a computer and can’t install a client.

Google Calendar seems to be a good choice. It’s flexible and can sync with lots of things.

Linux

So I installed Lightning on all my Fedora and Ubuntu machines. It’s a calendar extension for Thunderbird, which I already use. To install it yourself:

On Fedora:
yum install thunderbird-lightning
On Ubuntu:
apt-get thunderbird-lightning

It’s easy to set up, too. Suppose your Google account is joebloggs@gmail.com, then you would…

  • Add a new calendar to Lightning by right-clicking in the Calendar area
  • Choose On the Network
  • Select CalDAV
  • Enter your location as https://www.google.com/calendar/dav/joebloggs@gmail.com/events
  • Give the calendar a name

OS X and Windows

It’s a little more work to install Lightning on OS X. You have to download the add-on from Mozilla, and install it in Thunderbird. Same story for Windows.

It’s quite straightforward and there are instructions on the website.

When you’re done, follow the same instructions as for Linux to subscribe to your Google calendar in Lightning.

Sony Ericsson UIQ

Setting up Google Calendar on my Sony Ericsson P1i was a bit of a pain, too. The P1i can’t interact with Google natively, I had to set up an account with Goosync to enable this. Goosync talks to Google, and your phone talks to Goosync using SyncML.

But once you have a Goosync account, you can synchronise a lot of handsets with Google calendar.

So first, you will need to set up an account with Goosync. It’s free and very easy. Goosync will ask you to tie your Goosync account to your Google account.

There’s also an option to have the settings for your phone sent automatically to your handset. However this didn’t work for me so I had to enter the settings manually.

Assuming the sync task on your phone has been set up properly, do a  test run to make sure it all works.

  • If possible, connect to a wireless network first. If not, 3G will have to do.
  • Go to the Main Menu
  • Go to Tools
  • Go to Remote Sync
  • Find the profile that syncs with Goosync
  • Find the sync task called Calendar. Make sure it is ticked, and then tap Sync to start off the first synchronisation.

If that worked, you can now run the sync task whenever you like from within the calendar itself.

  • Open your phone calendar
  • Tap More
  • Tap Calendar manager
  • Tap Synchronise

That’s all there is to it! Unfortunately there’s no way of making your calendar synchronise automatically at set intervals, but that’s probably a good thing, because you can’t get stung for 3G charges!

iPhone and iPod touch

Coming soon…