从 python 库调用时,Solaris 上的 BeanStalkd 不会返回任何内容
我正在使用 Solaris 10 操作系统(x86)。 我安装了 beanstalkd 并使用命令“beanstalkd -d -l hostip -p 11300”启动正常。
我的系统上有 Python 2.4.4 我安装了 YAML 和 beanstalkc python 库来将 beanstalkd 与 python 连接我的问题是当我尝试编写一些代码时:
import beanstalkc beanstalk = beanstalkc.Connection(host='hostip', port=11300)
到目前为止没有错误,但是当我尝试在 beanstalk 上执行某些操作(例如列出队列)时。 什么都没发生。
beanstalk.tubes()
它只是挂起并且没有任何返回。 如果我取消操作(在 python 环境中使用 ctr+c)或停止服务器,我会立即看到输出:
Traceback (最近一次调用最后): 文件“”,第 1 行,在 ? 文件“/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py”,第 134 行,在管中 return self._interact_yaml('list-tubes\r\n', ['确定']) 文件“/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py”,第 83 行,位于 _interact_yaml 中 大小,= self._interact(命令,expected_ok,expected_err) 文件“/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py”,第 57 行,在 _interact 中 状态,结果 = self._read_response() 文件“/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py”,第 66 行,在 _read_response 中 响应 = self.socket_file.readline().split() 文件“/usr/lib/python2.4/socket.py”,第 332 行,在 readline 中 data = self._sock.recv(self._rbufsize)
知道发生了什么吗? 我是一个 Unix 新手,所以我不知道我做错了什么导致了这个问题。
编辑:似乎问题出在 BeanStalkd 本身,有人在 Solaris 10 上使用过这个吗? 如果是的话,您使用的是哪个版本? 标记为 1 的 v1.3 无法在 Solaris 上编译,而 git 代码存储库中的最新版本编译它会导致上述问题(或者可能需要在 Solaris 上进行一些配置?)。
edit2:我使用 beanstalkd、PyYAML、pythonbeanstalc 和 libevent 在 UBUNTU 机器上安装并编译了相同的组件,并且工作正常。 问题似乎与在Solaris上编译beanstalkd有关,我还没有生成或阅读任何解决方案。
i am using Solaris 10 OS(x86). i installed beanstalkd and it starts fine by using command "beanstalkd -d -l hostip -p 11300".
i have Python 2.4.4 on my system i installed YAML and beanstalkc python libraries to connect beanstalkd with python my problem is when i try to write some code:
import beanstalkc
beanstalk = beanstalkc.Connection(host='hostip', port=11300)
no error so far but when i try to do someting on beanstalk like say listing queues. nothing happens.
beanstalk.tubes()
it just hangs and nothing returns. if i cancel the operation(using ctr+c on python env.) or stop the server i immediately see an output:
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 134, in tubes
return self._interact_yaml('list-tubes\r\n', ['OK'])
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 83, in _interact_yaml
size, = self._interact(command, expected_ok, expected_err)
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 57, in _interact
status, results = self._read_response()
File "/usr/lib/python2.4/site-packages/beanstalkc-0.1.1-py2.4.egg/beanstalkc.py", line 66, in _read_response
response = self.socket_file.readline().split()
File "/usr/lib/python2.4/socket.py", line 332, in readline
data = self._sock.recv(self._rbufsize)
any idea whats going? i am an Unix newbie so i have no idea what i did setup wrong to cause this.
edit: seems like the problem lies within BeanStalkd itself, anyone have used this on Solaris 10? if so which version did you use? The v1.3 labeled one doesnt compile on Solaris while the latest from git code repository compiles it causes the above problem(or perhaps there is some configuration to do on Solaris?).
edit2: i installed and compiled same components with beanstalkd, PyYAML, pythonbeanstalc and libevent to an UBUNTU machine and it works fine. problems seems to be about compilation of beanstalkd on solaris, i have yet to produce or read any solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我可能知道出了什么问题:不要以守护进程(-d)模式启动它。 我也经历过同样的事情,偶然间我发现了问题所在。
或者更确切地说,我不知道出了什么问题,但它无需在守护进程模式下运行即可工作。
./beanstalkd -p 9977 &
作为备选。
I might know what is wrong: don't start it in daemon (-d) mode. I have experienced the same and by accident I found out what is wrong.
Or rather, I don't know what is wrong, but it works without running it in daemon mode.
./beanstalkd -p 9977 &
as an alternative.
看来python-client监听服务器,
但服务器无话可说。
有什么东西可以给客户读吗?
是否有消费者和生产者?
看看这个
It seems that the python-client listens to the server,
but the server has nothing to say.
Is there something to read for the client?
Is there a consumer AND a producer ?
Look at this
查看代码(beanstalkc)后:
您的客户已发送他的“list-tubes”消息,并且正在等待答复。
(直到你杀死它)
您的服务器没有应答或无法将答案发送给客户端。
(或者答案比客户期望的要短)
是您身边(或站点)的网络管理员:-)
After looking in the code (beanstalkc):
your client has send his 'list-tubes' message, and is waiting for an answer.
(until you kill it)
your server doesn't answer or can't send the answer to the client.
(or the answer is shorter than the client expect)
is a network-admin at your side (or site) :-)