Gearman, Memcached, PHP Gearman PECL

Februar 27th, 2010

This a short Tutorial on Howto Install Gearman with libdrizzel, libmemcached and the Gearman PHP PECL Extension on Debian. It also works on Ubuntu, you just have to use the sudo wrapper.
I presume you have a complete LAMP Stack, gcc, g++ and make installed.

Installing required libs

apt-get install memcached php5-memcache php5-dev
apt-get install libevent-dev uuid-dev autoconf

Getting the Files you need

wget http://launchpad.net/gearmand/trunk/0.11/+download/gearmand-0.11.tar.gz
wget http://launchpad.net/libdrizzle/trunk/0.7/+download/libdrizzle-0.7.tar.gz
wget http://launchpad.net/libmemcached/1.0/0.38/+download/libmemcached-0.38.tar.gz

Note: I know that there is Gearman 0.12, but this currently doesn’t work with the PHP PECL Client.
See the Google Group Discussion here:
http://groups.google.com/group/gearman/browse_thread/thread/2af9ff7bfd613c2e

Installing libdrizzle

tar -xzvf libdrizzle-0.7.tar.gz
cd libdrizzle-0.7
./configure
make
make install

Installing libmemcached

tar -xzvf libmemcached-0.38.tar.gz
cd libmemcached-0.38
./configure
make
make install

Installing Gearmand

tar -xzvf gearmand-0.11.tar.gz
cd gearmand-0.11
./configure
make
make install

Installing PHP Gearman PECL Extension

pecl install --force gearman

Loading PECL Extension

nano /etc/php5/apache2/php.ini

Look for the Dynamic Extensions Section and add

extension=gearman.so

After that the Webserver must be restarted.

Starting the gearmand Deamon

/usr/local/sbin/gearmand --pid-file=/var/run/gearman.pid --log-file=/var/log/gearman.log --job-retries=3 -d -u root

Starting the gearmand Deamon (with libdrizzle)

/usr/local/sbin/gearmand --pid-file=/var/run/gearman.pid --log-file=/var/log/gearman.log --job-retries=3 -d -u root -q libdrizzle --libdrizzle-host=127.0.0.1 --libdrizzle-user=gearman --libdrizzle-password=mysqlpasswd --libdrizzle-db=gearman --libdrizzle-table=gearman_queue --libdrizzle-mysql

Note: If the MySQL settings are no correct, the Deamon will not start and also not throw an exception. So if you are using libdrizzle and the server does not start, check your mysql settings!

Troubleshooting
gearmand doesn’t start complaining about missing shared objects (.so)
Check your library include path.

nano /etc/ld.so.conf.d/libc.conf

this should look like this:

# libc default configuration
/usr/local/lib

Then try

libconf

fixed it for me :).

Entry Filed under: Linux,Software,Webentwicklung

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Random Wisdom

“It's not that Perl programmers are idiots, it's that the language rewards idiotic behavior in a way that no other language or tool has ever done.”

Categories

Archiv