Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

So:

$ 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/gearmand.pid --user=gearman --daemon --log-file=/var/log/gearman-job-server/gearman.log --listen=127.0.0.1

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

Fail!

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 stackoverflow.com Jan 15 '12 at 4:14

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

2 Answers 2

up vote 6 down vote accepted

The problem is that the daemon is listening on 127.0.0.1/local 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 127.0.0.1 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

Your Answer

 
discard

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.