我正在尝试让我的芹菜守护进程在机架空间的Ubuntu盒子上运行,但是我无法将芹菜与rabbitmq连接起来。在我的Mac上,使用默认的rabbitmq设置(BROKER_URL ='amqp://')一切正常,但在生产服务器上,我无法让芹菜与rabbitmq交谈。
这就是我所做的:
$ sudo rabbitmqctl add_user celeryuser celerypassword
$ sudo rabbitmqctl add_vhost celeryhost
$ sudo rabbitmqctl set_permissions -p celeryhost celeryuser ".*" ".*" ".*"
遵循here
的指示在celeryconfig.py
中我使用上面的配置
BROKER_URL = 'amqp://celeryuser:celerypassword@localhost:5672/celeryhost'
并在celery_app.py
中我使用以下内容加载上述配置:
app.config_from_object('proj.celeryconfig')
然而,当我尝试用以下方式启动芹菜工人时:
celery worker --app=proj.celery_app
我收到以下错误:
-------------- celery@app1 v3.1.13 (Cipater)
---- **** -----
--- * *** * -- Linux-2.6.32-64-server-x86_64-with-Ubuntu-10.04-lucid
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: proj:0x29e9850
- ** ---------- .> transport: amqp://celeryuser:**@localhost:5672/celeryhost
- ** ---------- .> results: amqp
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ----
--- ***** ----- [queues]
-------------- .> celery exchange=celery(direct) key=celery
[2014-09-12 09:28:00,266: ERROR/MainProcess] consumer: Cannot connect to amqp://celeryuser:**@localhost:5672/celeryhost: Couldn't log in: unexpected method received.
Trying again in 2.00 seconds...
我检查了rabbitmq服务器是否正在运行:
$ sudo rabbitmqctl status
结果是:
Status of node rabbit@app1 ...
[{running_applications,[{rabbit,"RabbitMQ","1.7.2"},
{mnesia,"MNESIA CXC 138 12","4.4.12"},
{os_mon,"CPO CXC 138 46","2.2.4"},
{sasl,"SASL CXC 138 11","2.1.8"},
{stdlib,"ERTS CXC 138 10","1.16.4"},
{kernel,"ERTS CXC 138 10","2.13.4"}]},
{nodes,[rabbit@app1]},
{running_nodes,[rabbit@app1]}]
...done.
答案 0 :(得分:1)
这种情况正在发生,因为ubuntu服务器安装了更旧版本的rabbitmq然后我在我的开发机器上。
当我看到rabbitmq工作者的状态时,我意识到了......版本说明了:
{rabbit,"RabbitMQ","1.7.2"},
但在我当地的我有
{rabbit,"RabbitMQ","3.3.4"},
我在ubuntu上更新了rabbitmq服务器的版本并使用this帖子作为指南设置了与上面相同的权限
现在我能够在生产机器上成功启动芹菜工人。