Skip to content

Instantly share code, notes, and snippets.

@roscius
Last active December 18, 2015 00:19
Show Gist options
  • Select an option

  • Save roscius/5695681 to your computer and use it in GitHub Desktop.

Select an option

Save roscius/5695681 to your computer and use it in GitHub Desktop.

Install Gearman and Supervisor on Ubuntu 12.04

Download the latest version of Gearman from: https://launchpad.net/gearmand/

Add required libraries:

apt-get install build-essential libboost-thread-dev libboost-program-options-dev libevent-dev libcloog-ppl0 libmysqld-dev uuid-dev -y

Build Gearman:

./configure
make
make install
ldconfig

Add the MySQL DB:

CREATE DATABASE gearman;

CREATE USER 'gearman'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON gearman.* TO 'gearman'@'localhost';

FLUSH PRIVILEGES;

Create the upstart process:

nano /etc/init/gearmand.conf

description "Gearmand Server"

start on startup
stop on runlevel [016]

kill timeout 3

respawn

exec gearmand \
--log-file=/var/log/gearmand.log \
--queue-type=MySQL \
--mysql-host=192.168.1.10 \
--mysql-port=3306 \
--mysql-user=gearman \
--mysql-password=your_password \
--mysql-db=gearman \
--mysql-table=gearman_01

Start the daemon:

sudo service gearmand start

Reference: http://blog.andyburton.co.uk/index.php/2012-12/compiling-gearman-with-mysql-persistent-storage-on-ubuntu-12-04-precise/

Install the PHP Extension:

sudo pecl install gearman

echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini

Install Supervisor:

sudo apt-get install python-setuptools
sudo easy_install supervisor
sudo su root
echo_supervisord_conf > /etc/supervisord.conf

http://edvanbeinum.com/how-to-install-and-configure-supervisord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment