Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Gearman installed, running and passing jobs around perfectly fine but only when I manually start up the job queue with this command:

/usr/sbin/gearmand -p 4730 -vvvv -u gearman 

If I do this I have another EC2 instance running as a worker and a third passing in jobs. Perfect, but I don't want to have to keep a terminal open (obviously) or mess around with screen. I'd like this to run on startup.


$ ps aux | grep gearman
gearman    745  0.2  0.2   8096  1388 ?        Ss   19:11   0:00 /usr/sbin/gearmand --pid-file=/var/run/gearman/ --user=gearman --daemon --log-file=/var/log/gearman-job-server/gearman.log --listen=

Looks good to me. But when I tell my worker to connect:

$ php workers/resize.php 
Waiting for job...
PHP Warning:  GearmanWorker::work(): gearman_connection_flush:write:111 in /home/ubuntu/workers/resize.php on line 20


Also I have noticed nothing is going into the log file (it was not created automatically, but was referenced in this init.d script on install). I tried creating it and even chowning to gearman:gearman but no joy there, so it's tough to debug.

share|improve this question

migrated from Jan 15 '12 at 4:14

This question came from our site for professional and enthusiast programmers.

up vote 7 down vote accepted

The problem is that the daemon is listening on loopback rather than a public IP.

This is specified in /etc/default/gearman-job-server on Ubuntu.

Change it to the public IP of the machine, restart the daemon with the init script and all should be well.

share|improve this answer
Correct! A quick note for any EC2 folks, use the "Private IP" listed on your account if your workers are on EC2 as well. Public IP didn't seem to work. – Phil Sturgeon Jan 14 '12 at 0:40
Good to know that. I really didn't like the idea of making the daemon publicly available. – tishma Mar 17 '13 at 17:06

Typically this error happens due to a parameter in GearmanClient::addServer(). It doesn't like "localhost" as a parameter. Try specifying or specifying nothing.

share|improve this answer
They are all on different instances so they have a host name in the first parameter. – Phil Sturgeon Jan 13 '12 at 19:31
When I left the field blank (default), it couldn't connect locally. I specified everywhere and then it worked locally. – DanFromGermany Apr 12 at 12:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.