背景:由于项目中想要使用celery,而celery推荐的Broker是RabbitMQ和redis,而默认的则仅有RabbitMQ,由于没接触过RabbitMQ,想要尝试一下
安装
>>> docker pull rabbitmq:3-management
初始化
>>> docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
>>> docker exec -it rabbitmq /bin/bash
> rabbitmqctl add_user user userpasswd
Adding user "user" ...
> rabbitmqctl add_vhost myvhost
Adding vhost "myvhost" ...
# 将user添加到administrator标签组中,否则无法使用user用户名登录web管理界面
> rabbitmqctl set_user_tags user administrator
Setting tags for user "user" to [administrator] ...
> rabbitmqctl set_permissions -p myvhost user ".*" ".*" ".*"
Setting permissions for user "user" in vhost "myvhost" ...
登录web管理端
http://127.0.0.1:15672