I have compiled Gearman on my ubuntu machine and it works fine in localhost mode but I get a connection error when connecting from another machine to add a new job to the queue.
I have tried…
- Editing the config file located at
/etc/default/gearman-job-server
to add--listen={ip-here}
and that did nothing. - Editing the upstart script directly to add the
--listen
flag and that did nothing either. - Editing the
/etc/init.d/gearman-job-server
file to add the--listen
and--port
paramaters to the start script. - Manually editing the upstart file at
/etc/init/gearman-job-server.conf
and commenting out the existing exec line and adding in the following lines after therespawn
command…
script
exec gearmand --listen={ip} --port=4703
end script
The only way I have Gearman working at the moment is by manually running the command gearmand -d -listen={ip} --port=4703
which has made it work. Now I understand that the -d
flag launches it in daemon mode which has allowed me to close the SSH session while still keeping it running but any machine reboot is going to put me right back where I started.
I want to have Gearman automatically start on boot, or restart through the sudo service
command listening to the correct IP and port and I don't want to have to log into the server every time something goes wrong to manually start the daemon again.
I have been through serverFault which led me to the first two options but still needing help as neither of those worked.
Best Answer
Managed to get this figured by digging right into the Debian bug reports...
Even though Gearman has the config file located in
/etc/default/gearman-job-server
and even though it has entries in the/etc/init/
and/etc/init.d/
directories these are apparently ignored in many installations (Possible from the point that theinit.d
command for service control was superceeded by theservice
command but basically what you need to do it.../lib/systemd/system
directory and opengearman-job-server.service
in your chosen text editor.ExecStart
command. At this point you can either manually code in the parameters you want or you can include the default params environment variable by adding$PARAMS
to the end of the line. The parameters you care about are the--listen
and--port
parameters. The listen parameter should be the publicly accessible IP of your server.sudo systemctl daemon-reload
sudo service gearman-job-server restart