允许RabbitMQ-Server连接



我正在尝试让Django芹菜工作器连接到RabbitMQ服务器,所有运行在同一台主机上。

然而,当我运行manage.py celery worker时,我得到的是:

[2013-06-11 17:33:41,185: WARNING/MainProcess] celery@localhost has started.
[2013-06-11 17:33:44,192: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 2 seconds...
[2013-06-11 17:33:50,203: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 4 seconds...
[2013-06-11 17:34:03,214: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 6 seconds...
[2013-06-11 17:34:27,232: ERROR/MainProcess] Consumer: Connection Error: Socket closed. Trying again in 8 seconds...

当我检查我的/var/log/rabbitmq/rabbit@localhost.log时,我看到一些消息,如:

=ERROR REPORT==== 11-Jun-2013::17:33:44 ===
exception on TCP connection <0.201.0> from 127.0.0.1:43461
{channel0_error,opening,
                {amqp_error,access_refused,
                            "access to vhost 'myapp' refused for user 'guest'",
                            'connection.open'}}

我使用的是Ubuntu 12.04的标准包,默认设置和我的django-芹菜设置如下:

BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "myapp"

为什么RabbitMQ拒绝连接?

看起来你需要授予"guest"用户对"/myapp" vhost的访问权限。

From the docs:

set_permissions [-p vhostpath] {user} {conf} {write} {read}

类似的代码会给你的客户用户无限的访问权限:

rabbitmqctl set_permissions -p /myvhost guest ".*" ".*" ".*"

相关内容

  • 没有找到相关文章

最新更新