rabbitmq 初体验

docker 安装 rabbitmq

#!/bin/bash
docker rm -f rabbitmq
docker run -d --name rabbitmq \
     -p 5672:5672 \
     -p 15672:15672 \
     -e RABBITMQ_DEFAULT_USER=user \
     -e RABBITMQ_DEFAULT_PASS=password \
     -v /Users/ailuoy/docker/rabbitmq/data:/var/lib/rabbitmq \
     rabbitmq:latest

创建用户和设置权限

创建用户和设置权限

rabbitmqctl add_user ailuoy ailuoy
# (Tag可以为 administrator,monitoring, management)
rabbitmqctl set_user_tags ailuoy administrator

添加vhost和设置权限

rabbitmqctl add_vhost ailuoy
rabbitmqctl set_permissions -p / ailuoy ".*" ".*" ".*"

其他命令

查看用户

rabbitmqctl list_users

查看vhosts

rabbitmqctl list_vhosts

删除用户

rabbitmqctl delete_user username

改密码

rabbimqctl change_password username newpassword

开启web管理界面

rabbitmq-plugins enable rabbitmq_management