Q4M on CentOS
Q4MをBacklogで導入しようかどうか検討していて、インストールしたのでメモ。
インストール環境は以下
手順は以下。
依存パッケージをインストール
yum install gcc gcc-c++ autoconf automake libtool rpm-build boost boost-devel
MySQLインストール
バイナリパッケージを下記URLからダウンロードしてインストール
http://dev.mysql.com/downloads/mysql/5.1.html
- MySQL-client-community-5.1.30-0.rhel5.i386.rpm
- MySQL-devel-community-5.1.30-0.rhel5.i386.rpm
- MySQL-server-community-5.1.30-0.rhel5.i386.rpm
- MySQL-shared-community-5.1.30-0.rhel5.i386.rpm
rpm -Uvh MySQL-*
MySQLソースパッケージを展開してビルド
cd /usr/local/src wget http://dev.mysql.com/get/Downloads/MySQL-5.1/MySQL-community-5.1.30-0.rhel5.src.rpm/from/http://ftp.jaist.ac.jp/pub/mysql/ yum install gperf readline-devel ncurses-devel zlib-devel rpmbuild --recompile --define 'community 1' MySQL-community-5.1.30-0.rhel5.src.rpm
Q4M を ビルド & インストール
ソースから入れる。
http://q4m.31tools.com/dist/q4m-0.8.3.tar.gz
cd /usr/local/src wget http://q4m.31tools.com/dist/q4m-0.8.3.tar.gz tar zxfv q4m-0.8.3.tar.gz cd q4m-0.8.3 ./configure --with-mysql=/usr/src/redhat/BUILD/mysql-5.1.30 make make install
インストール後
Thank you for installing Q4M. If this is the first time to install Q4M, please run support-files/install.sql and activate it. % mysql -u root -f mysql < support-files/install.sql Once you have activated Q4M, you can try running the tests bundled to this ditribution, by typing % make test The tests are written in perl, so you can specify database locations using perl-style DBI strings, for example: % DBI='dbi:mysql:database=test2;host=testhost' \ DBI_USER='testuser' \ DBI_PASSWORD='testpass' \ make test Have fun!
mkdir /usr/lib/mysql/plugin ln -s /usr/lib/libqueue_engine.* /usr/lib/mysql/plugin/ mysql -uroot -p -f mysql < support-files/install.sql
テストするために、以下のCPANモジュールが必要なのでインストール
テストを実行
DBI_USER="root" DBI_PASSWORD="***" make test ---------------------------------------------------------------------------------------------------- ./run_tests.pl t/01-base-rnd_pos.........................ok t/01-base.................................ok t/02-queue-cond...........................ok t/02-queue-owned-delete...................ok t/02-queue................................ok t/03-queue-error-wait.....................ok t/03-queue-error..........................ok t/04-blob-cond............................ok t/04-blob.................................ok t/05-multireader..........................ok 1/4 Multireader benchmark result: Number of messages: 6400 Number of readers: 32 Elapsed: 1.710 seconds Throughput: 3743.469 mess./sec. t/05-multireader..........................ok t/05-multirw..............................ok 1/4 Multi-reader-writer benchmark result: Number of messages: 6400 Number of readers: 32 Elapsed: 2.561 seconds Throughput: 2498.844 mess./sec. t/05-multirw..............................ok t/05-multiwait............................ Multi-reader-writer benchmark result under semi-starvation: Number of messages: 6400 Number of readers: 32 Elapsed: 2.347 seconds Throughput: 2726.886 mess./sec. t/05-multiwait............................ok t/06-multi................................ok t/07-trans................................ok t/08-forward..............................ok t/09-pqueue-single-table-wake-listener....ok t/09-pqueue-single-table..................ok All tests successful. Files=17, Tests=68921, 203 wallclock secs (119.44 cusr + 5.01 csys = 124.45 CPU)
Tutorialをためす
http://q4m.31tools.com/tutorial.php
SELECT * FROM my_queue WHERE queue_wait('my_queue');
でブロックするのがなんか新鮮。