Access denied by user rabbitmq & celery

I create vhost:

rabbitmqctl add_vhost test 

Then the user:

 rabbitmqctl add_user user 123456 

Then I take permissions for this user:

 rabbitmqctl set_permissions -p test user "test" "test" "test" 

I use celery in tasks.py:

 app = Celery('tasks', broker='amqp://user: 123456@localhost /test', backend='amqp://user: 123456@localhost /test') 

Then I run:

 celery -A tasks worker --loglevel=info 

I have an error:

 amqp.exceptions.AccessRefused: Exchange.declare: (403) ACCESS_REFUSED - access to exchange 'celeryev' in vhost 'test' refused for user 'user' 

How to fix it?

Thanks!

+7
python celery rabbitmq
source share
2 answers

Take a look at set_permissions here: https://www.rabbitmq.com/man/rabbitmqctl.1.man.html#Access%20control

When you call set_permissions, you pass a "test" to configure, read and write, so your user can only use the queue / exchange named "test"

Also, take a look at this link: https://www.rabbitmq.com/access-control.html

+9
source share

If you still have a mistake, make sure you have the correct double quotes (happened to me)

 ".*" 

instead

 ".*" 

Of course, list permissions from users in your vhostpath (default /)

 rabbitmqctl list_permissions -p / 
0
source share

All Articles