1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RabbitMQ に cerelyから接続する際のguest アカウントでの接続エラー

Last updated at Posted at 2021-08-28

問題

以下のpython スクリプトで rabbitMQに接続しようとしたが、

# tasks.py

import celery
import time
import random

app = celery.Celery('tasks', broker='amqp://quest@localhost',
                    backend='amqp://quest@localhost')  # AMQP advanced message queuing protocol

@app.task
def build_server():
    print("wait 10sec")
    time.sleep(10)
    server_id = random.randint(1, 100)
    return server_id

下記のエラーで返された。

$ celery -A tasks worker --loglevel=info

amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.

rabbitMQのlogを見ると以下 /var/log/rabbitmq配下

=ERROR REPORT==== 28-Aug-2021::13:19:01 ===
Error on AMQP connection <0.287.0> (127.0.0.1:42252 -> 127.0.0.1:5672, state: starting):
AMQPLAIN login refused: user 'quest' - invalid credentials

環境

celery 5.1.2 -> 4.1.1
python 3.6
ubuntu 18.04
RabbitMQ 3.6.10
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 9.2

やったこと

  • celery を 5.1.2から4.1.1に変更
     そもそもceleryの5.1.2では、AMQPプロトコルに対応してないとのことだった。

  • rabbitmqのユーザー確認

sudo rabbitmqctl list_users
Listing users
guest	[administrator]
  • ユーザーパス変更
$ sudo rabbitmqctl change_password guest guest
Changing password for user "guest"

# 解決

guestじゃなくて questじゃねーか!!!

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?