Unable to run “gearman” command line tool with gearman 1.1.6

六月ゝ 毕业季﹏ 提交于 2020-01-13 06:53:08

问题


I am trying to run the example on "http://gearman.org/getting_started" on Ubuntu in VirtualBox environment.

At first I tried to download an old version 0.16 by using apt-get install gearman-job-server, apt-get install gearman-tools and everything worked well. The server ran in the background, I was able to create 2 workers and verify that I can call them by creating a client.

I decided to download and compile the latest version, 1.1.6. Now, I am trying to do the same thing with the new version and I am having errors.

I run the server as admin:

  sudo gearmand

The statement

  gearadmin --getpid

seems to work - it returns me the process ID of the server. Thus, the server is running, and this answer is not relevant.


Now, I am adding a worker:

 gearman -w -f wc -- wc -l 

It seems to run.

Nevertheless,

gearadmin --workers 

results in something that probably represents and empty list :

33 127.0.0.1 - :
.

(In version 0.16, I was able to see 2 lines, the second showing the registered function name.)


Attempting to run the client

 gearman -f wc < /etc/passwd

results in

 gearman: gearman_client_run_tasks : flush(GEARMAN_COULD_NOT_CONNECT) localhost:0 -> libgearman/connection.cc:671"

This might be the very same problem described in here - the port not specified, but I have no idea how to do it through the command line tool.

Any idea?


回答1:


Ok, It looks like the answer in here was the key to success. Probably, the "getting started" section was not updated for a while. Indeed, one must specify a port explicitly for gearmand and gearman .

Server:

 sudo gearmand -p 5000

Worker:

 gearman -p 5000 -w -f wc -- wc -l 

Client:

 gearman -p 5000 -f wc < /etc/passwd


来源:https://stackoverflow.com/questions/16281714/unable-to-run-gearman-command-line-tool-with-gearman-1-1-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!