Celery-Beat:ACCESS_REFUSED-使用身份验证机制AMQPLAIN

时间:2018-11-27 13:15:02

标签: python django docker rabbitmq celery

我在芹菜拍打容器上出现错误。

Celery-Beat错误日志:

[2018-11-27 12:40:21,139: WARNING/MainProcess] (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
[2018-11-27 12:40:21,241: WARNING/MainProcess] Sentry is attempting to send 1 pending error messages
[2018-11-27 12:40:21,241: WARNING/MainProcess] Waiting up to 10 seconds
[2018-11-27 12:40:21,241: WARNING/MainProcess] Press Ctrl-C to quit
celery beat v4.0.2 (latentcall) is starting.
__    -    ... __   -        _
LocalTime -> 2018-11-27 12:40:19
Configuration ->
    . broker -> amqp://RabbitUser:**@rabbit:5672//
    . loader -> celery.loaders.app.AppLoader
    . scheduler -> celery.beat.PersistentScheduler
    . db -> celerybeat-schedule
    . logfile -> [stderr]@%INFO
    . maxinterval -> 5.00 minutes (300s)

RabbitMq日志:

=INFO REPORT==== 27-Nov-2018::12:40:19 ===
closing AMQP connection <0.308.0> (192.168.48.3:36552 -> 192.168.48.4:5672)

=INFO REPORT==== 27-Nov-2018::12:40:24 ===
accepting AMQP connection <0.313.0> (192.168.48.2:56664 -> 192.168.48.4:5672)

=ERROR REPORT==== 27-Nov-2018::12:40:24 ===
Error on AMQP connection <0.313.0> (192.168.48.2:56664 -> 192.168.48.4:5672, state: starting):
AMQPLAIN login refused: user 'RabbitUser' - invalid credentials

=INFO REPORT==== 27-Nov-2018::12:40:24 ===
closing AMQP connection <0.313.0> (192.168.48.2:56664 -> 192.168.48.4:5672)

根据日志,这是身份验证错误吗?

当我尝试卷曲时,它成功连接到兔子:

->curl -i -u RabbitUser:guest http://localhost:5672/api/whoami
  AMQP

我该如何解决?

1 个答案:

答案 0 :(得分:0)

我假设您没有使用虚拟主机RabbitUser创建一个名为rabbit的RabbitMQ用户:

在控制台中输入以下内容:

rabbitmqctl add_user RabbitUser YOURPASSORDHERE
rabbitmqctl add_vhost rabbit
rabbitmqctl set_user_tags RabbitUser administrator
rabbitmqctl set_permissions -p rabbit RabbitUser ".*" ".*" ".*"
rabbitmqctl delete_user guest

这将使用所需的密码创建用户RabbitUser,添加虚拟主机rabbit,设置用户管理员并为您授予虚拟主机rabbit的权限