I create vhost:
rabbitmqctl add_vhost test
Then user:
rabbitmqctl add_user user 123456
Then I take permissions to that 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 error:
amqp.exceptions.AccessRefused: Exchange.declare: (403) ACCESS_REFUSED - access to exchange 'celeryev' in vhost 'test' refused for user 'user'
How to fix that?
Take a look at set_permissions here: https://www.rabbitmq.com/rabbitmqctl.8.html#Access_control
When you call set_permissions you are passing "test" for configure, read and write, so your user will be able to only use a queue/exchange by the name "test"
Also, take a look at this link as well: https://www.rabbitmq.com/access-control.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With