Difference between revisions of "Setting up Gearman"

From Dreamwidth Notes
Jump to: navigation, search
(add instructions for installing Gearman server on a dreamhack)
(For Dreamhacks: s/sophie/mark/ where appropriate)
 
Line 31: Line 31:
 
  perl -Iextlib/lib/perl5 extlib/bin/gearmand --port=[choose a port number] &
 
  perl -Iextlib/lib/perl5 extlib/bin/gearmand --port=[choose a port number] &
  
Ask Sophie if you need help figuring out which port number you should use for your Gearman server.
+
Ask Mark if you need help figuring out which port number you should use for your Gearman server.
  
 
==Using Gearman with DW==
 
==Using Gearman with DW==

Latest revision as of 02:46, 11 December 2018

About

An asynchronous job scheduling engine, of the type "do this somewhere else". Benefits: somewhere else, fast. Flaws: currently if it dies jobs are lost (apparently the team that manages it is working on that). Name is an anagram of "manager"; from LiveJournal days.

Setup

Install the server:

sudo apt-get install gearman-server

And also edit /etc/default/gearman-server so that ENABLED is true.

Run the daemon:

sudo /etc/init.d/gearman-server start

Might want to add it to startup.

For Dreamhacks

If you don't have root, you will need to install the Gearman server locally instead of using the above instructions.

cd $LJHOME
mkdir -p extlib
cpanm -n -Lextlib Gearman::Server

Then to run the server:

perl -Iextlib/lib/perl5 extlib/bin/gearmand --port=[choose a port number] &

Ask Mark if you need help figuring out which port number you should use for your Gearman server.

Using Gearman with DW

Once you have Gearman running, you need to add this to your configs in the LJ section somewhere:

@GEARMAN_SERVERS = ('localhost:7003');

Port 7003 is the default port for a gearman server running as root; dreamhack users should instead use their port number as chosen above.

When looking for examples of gearman workers in existing code, try:

egrep -i gearman bin/worker/*