Difference between revisions of "Setting up Gearman"
Foxfirefey (Talk | contribs) (Created page with ' Install the server: sudo apt-get install gearman-server Run the daemon: sudo /etc/init.d/gearman-server start Might want to add it to startup. [[Category: Dreamwidth Inst…') |
m (→Using Gearman with DW) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | ==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. | ||
+ | * [http://azurelunatic.dreamwidth.org/6323528.html IRC log with history/discussion] | ||
+ | * [[Production_Notes#Gearman|Gearman on Dreamwidth]] | ||
+ | * [http://gearman.org/ gearman.org] | ||
+ | |||
+ | ==Setup== | ||
Install the server: | Install the server: | ||
sudo apt-get install gearman-server | sudo apt-get install gearman-server | ||
+ | |||
+ | And also edit <tt>/etc/default/gearman-server</tt> so that ENABLED is true. | ||
Run the daemon: | Run the daemon: | ||
Line 10: | Line 19: | ||
Might want to add it to startup. | 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. | ||
+ | |||
+ | [*] Note: in fact, the default port for Gearman was changed to 4730 in early 2009 by IANA, but Dreamwidth continues to use 7003 in production for historical reasons. Admins of newer installations will probably want to specify localhost:4730 instead. | ||
+ | |||
+ | When looking for examples of gearman workers in existing code, try: | ||
+ | |||
+ | egrep -i gearman bin/worker/* | ||
[[Category: Dreamwidth Installation]] | [[Category: Dreamwidth Installation]] |
Latest revision as of 07:55, 15 November 2022
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.
[*] Note: in fact, the default port for Gearman was changed to 4730 in early 2009 by IANA, but Dreamwidth continues to use 7003 in production for historical reasons. Admins of newer installations will probably want to specify localhost:4730 instead.
When looking for examples of gearman workers in existing code, try:
egrep -i gearman bin/worker/*