TL;DR (The Short Version)

To use GearmanManager we need to use the previous version of PECL Gearman (currently v0.8.3) and thus the previous version of libgearman (Gearmand currently v0.41). Using Gearmand v0.41 we have native MySQL support with libmysqlclient.

The Long Version

The PHP PECL Gearman 1.x branch was written to work with with later gearmand versions (libgearman v0.21 and above), and which appears to have some fairly fundamental changes. As such this entire branch seems to be unstable and unusable with GearmanManager.

Once-upon-a-time if we wanted a persistent queue in MySQL we’d have to go through the pain of trying to get libdrizzle installed, however as of Gearman v0.38 libmysqlclient is supported, meaning we have native MySQL support. Hurrah!

I had some problems getting Gearman working on Ubuntu and figured others might have the same issues.

I’d previously written instructions for getting gearman working on 10.04 with standard ubuntu packages and with libdrizzle for persistent mysql storage of the jobs, but this didn’t work when attempting to use the latest version of gearman from launchpad and ubuntu 12.04 precise.

I opted to compile gearman from source on a clean installation of Ubuntu 12.04 Precise and after a bit of trouble getting libdrizzle to work found that gearman will compile with libmysql support for direct MySQL integration. This saved a lot of hassle, and here’s how i did it -

Set the MySQL server host, the port (default 3306), MySQL user (in my case named gearman), the user password, the database name for the gearman queues (i called mine gearman) and a table name to use for this server (i called mine gearman_01).

This will run the gearman program and store any jobs it received in the gearman_01 table. You will notice if you run the command above the gearman_01 table is created in the gearman database.

A better idea might be to put this code into an upstart job to create a daemon, so that gearman is started along with the server:

Up until now reliably backing up virtual machines from any of the free virtualisation hypervisors has been either expensive or impossible.

With the launch of Citrix XenServer 5.5 you can now not only take VM snapshots of live servers without shutting them down and taking them offline, you can also export these snapshots including the hard drive disk data to a template file. Continue reading →