Installing from Source (MySQL 5.5 and later)

For installing the source distribution, source code of MySQL is required.
  1. download and untar the source distribution of MySQL
  2. download the source distribution of Q4M from http://q4m.kazuhooku.com/dist/
  3. untar the Q4M source distribution under the storage/ directory of the MySQL source tree, and rename the created directory to q4m (i.e. mv storage/q4m-0.x.y storage/q4m)
  4. build MySQL (e.g. run CMake with appropriate arguments and then make in the root directory of the MySQL source tree) so that the Q4M plugin (storage/q4m/libqueue_engine.so) would be built as part of the MySQL build process
  5. copy the plugin into the plugins/ directory of the MySQL installation
  6. run storage/q4m/support-files/install.sql to activate the plugin
  7. (optionally) run the test suite

Installing from Source (MySQL 5.1)

For installing the source distribution, source code of MySQL is required.
  1. download and build MySQL 5.1 (installation is not mandatory, but if you plan to install Q4M into a binary distribution of MySQL, make sure to use the same configuration options for building the MySQL source distribution. The configuration of MySQL can be found in bin/mysqlbug script.)
  2. download the source distribution of Q4M from http://q4m.kazuhooku.com/dist/
  3. untar the Q4M distribution
  4. run configure
  5. run make
  6. run make install
  7. run support-files/install.sql
  8. (optionally) run the test suite
Below are the important options when configuring Q4M.
--with-mysql=mysql-source-dir
set the directory of MySQL source code (required)
--prefix=mysql-dir
set the directory under which MySQL 5.1 is installed (optional)
--with-debug
if your MySQL is built with --with-debug option, Q4M should be built with this option as well. Or your MySQL server will crash. (optional)
--with-sync=yes|no|fdatasync|fsync|fcntl
select disk synchronization method (default:yes). Fcntl is only avialable for Mac OS X, and is slow. If you have performance problems, changing this value would help.
--enable-mmap
use memory-mapped file for reading data (default:yes)
--with-delete=pwrite|msync
method for deleting rows, weather to use pwrite or write directly to mmaped file (default:pwrite)

Testing the Installation

To test your installation, run the run_tests.pl. You can set your database location by using the DBI environment variable. DBI_USER and DBI_PASSWORD variables are also avialable. An output like below should appear.
$ DBI='dbi:mysql:database=test;host=kazdev;port=3307' ./run_tests.pl
t/01-base................ok
t/02-queue...............ok
t/03-queue-error-wait....ok
t/03-queue-error.........ok
t/04-blob................ok
t/05-multireader.........

Multireader benchmark result:
    Number of messages: 6400
    Number of readers:  32
    Elapsed:            3.366 seconds
    Throughput:         1901.245 mess./sec.

t/05-multireader.........ok
All tests successful.
Files=6, Tests=5370, 140 wallclock secs (115.80 cusr +  5.92 csys = 121.72 CPU)
$ 

Source Repository of Q4M

Source repository of Q4M is located at http://github.com/q4m/q4m/.