齿轮给我GEARMAN_COULD_NOT_CONNECT,它肯定是运行 [英] gearman gives me GEARMAN_COULD_NOT_CONNECT, it is definitely running

查看:289
本文介绍了齿轮给我GEARMAN_COULD_NOT_CONNECT,它肯定是运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的开发服务器是Debian Squeeze,我正在运行Gearman 1.1.5,我从源码中编译了php pecl扩展v1.1.1



如果我运行reverse_client.php脚本我得到GEARMAN_COULD_NOT_CONNECT错误。



PHP警告:GearmanClient :: do():send_packet(GEARMAN_COULD_NOT_CONNECT)无法发送服务器-options数据包 - > libgearman / connection.cc:430在/home/bealers/build/gearman-1.1.1/examples/reverse_client.php第26行



这里有一些类似的帖子,他们都指出GM没有运行。



它是肯定运行。



我开始使用这些参数:



PARAMS = - queue-type = MySQL --mysql-db = test_db --mysql-user = gearman --mysql-password = gearman



我在test_db中放置了gearman_queue表,然后重新启动了表的重建守护程序,所以它的mysql连接很好,这显然是开始的。



我也可以telnet到本地主机4730 ,所以没有防火墙问题。



最初,GM因为在mysql之前启动而出现问题,所以我编辑了init脚本

  ### BEGIN INIT INFO 
#提供:gearman-job-server
#必需开始:$ network $ remote_fs $ syslog mysql

update-rd.c gearman-job-server默认值将其设置为开始,现在启动时开始正常。



我可以想到的唯一其他事情是,最初我通过apt安装版本是旧的,所以我删除它从源代码编译。 / usr / sbin / gearmand不再存在唯一的版本是/ usr / local / sbin / gearmand



ps ax |



Netstat只显示一个进程运行



tcp 0 0 *:4730 *:* LISTEN 2325 / gearmand



PECL lib似乎很好:



php -i | grep gearman

  /etc/php5/cli/conf.d/gearman.ini,
gearman
gearman support =>启用
libgearman version => 1.1.5

我没有想法

解决方案

我有同样的问题,最近在几天的挫折之后解决了这些问题(难以解决,因为有三个过程要担心: - )



出现(至少在我的情况下),GearmanClient :: addServer()和GearmanWorker :: addServer()的PHP文档不正确。具体来说,文档似乎暗示主机名和端口号是可选的,如果不指定主机名和端口号,它将使用localhost和端口4730作为默认值。这个永远不会起作用 - 今天突然发生了这样一个事情:为客户端和工作进程明确指定它们,一切都开始工作。



尝试指定主机名和端口的所有值,看看是否适用于您。


My dev server is Debian Squeeze and I'm running Gearman 1.1.5 which I compiled from source along with the php pecl extension v1.1.1

If I run the reverse_client.php script I get the GEARMAN_COULD_NOT_CONNECT error.

PHP Warning: GearmanClient::do(): send_packet(GEARMAN_COULD_NOT_CONNECT) Failed to send server-options packet -> libgearman/connection.cc:430 in /home/bealers/build/gearman-1.1.1/examples/reverse_client.php on line 26

There are a few similar posts on here about this and they all point to GM not running.

It is definitely running.

I'm starting it with these params:

PARAMS="--queue-type=MySQL --mysql-db=test_db --mysql-user=gearman --mysql-password=gearman"

If I drop the gearman_queue table in test_db then restart the daemon the table is recreated, so its mysql connection is fine and it's clearly starting.

I can also telnet to 4730 on localhost, so there's no firewall issue.

Initially GM had problems starting because it was starting before mysql, so I edited the init script

### BEGIN INIT INFO
# Provides:          gearman-job-server
# Required-Start:    $network $remote_fs $syslog mysql

and an update-rd.c gearman-job-server defaults sets it to start after and it starts fine on boot up now.

The only other thing I can think of is that initially I'd installed via apt but the version was to old so I removed it and compiled from source. /usr/sbin/gearmand no longer exists the only version is /usr/local/sbin/gearmand

ps ax | grep gearman shows only one process running.

Netstat shows only one process running`

tcp 0 0 *:4730 *:* LISTEN 2325/gearmand

The PECL lib seems fine:

php -i | grep gearman

/etc/php5/cli/conf.d/gearman.ini,
gearman
gearman support => enabled
libgearman version => 1.1.5

I'm out of ideas

解决方案

I had the same problem and recently solved them after a couple days of frustration (hard to troubleshoot since there are three processes to worry about :-)

It appears (at least in my case) that the PHP documentation for GearmanClient::addServer() and GearmanWorker::addServer() is incorrect. Specifically, the docs seem to imply that hostname and port number are optional and that it will use localhost and port 4730 as defaults if you do not specify them. This never works - it suddenly occurred to me today to try explicitly specifying them for both client and worker processes and everything started working.

Try specifying all values for hostnames and ports and see if this works for you.

这篇关于齿轮给我GEARMAN_COULD_NOT_CONNECT,它肯定是运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆