Problem with Gearman: GEARMAN_COULD_NOT_CONNECT

拜拜、爱过 提交于 2020-01-03 05:00:25

问题


I've installed gearman using "apt-get install gearman-server" and than build the PHP PECL.

If i try the worker:

$ gearman -w -f wc -- wc -l

It starts waiting. right.

But if i try to start a job (as descriped in the tutorial)

$ gearman -f wc < /etc/passwd

it says:

gearman: gearman_client_run_tasks : flush(GEARMAN_COULD_NOT_CONNECT) 127.0.0.1:4730 -> libgearman/connection.cc:480

And if i try the PHP str_rev demo descriped in the tutorial it gives me the very same error.

PHP Warning: GearmanClient::do(): flush(GEARMAN_COULD_NOT_CONNECT) 127.0.0.1:4730 -> libgearman/connection.cc:480 in /root/client.php on line 4

Here's the tutorial i've used: http://gearman.org/index.php?id=getting_started

Can someone help me?

Edit: Ok. I did the following: "apt-get remove gearman-server" and then "apt-get install gearman-job-server". Now the error is gone. But Another Problem: Both, Worker and Client, are now freezing. Just as they wait for something. Can someone help me?


回答1:


I had the same problem when working quickly through the example. It sounds like you don't have gearmand running - that's the process that will find available workers to do your job. Remember there are 3 parts - the client who wants the work done, the worker who will do the work, and the job-server (aka gearmand) who will find an available worker for the client's request.




回答2:


explicitly call: $worker->addServer("localhost",4730);



来源:https://stackoverflow.com/questions/6995202/problem-with-gearman-gearman-could-not-connect

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