docker部署单机rabbitmq(自测用)
docker 仓库地址: https://registry.hub.docker.com/_/rabbitmq/
拉取镜像
docker pull rabbitmq:3.8-management
启动容器
docker run -d --hostname rabbit-node --name my-rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3.8-management
进入容器
docker exec -it my-rabbit /bin/bash
查看 MQ 状态
/opt/rabbitmq/sbin/rabbitmqctl status
新增 rabbitmq 用户
/opt/rabbitmq/sbin/rabbitmqctl add_user rabbitadmin 'gECZ^edc'
设置角色
/opt/rabbitmq/sbin/rabbitmqctl set_user_tags rabbitadmin administrator
设置默认vhost("/")访问权限
/opt/rabbitmq/sbin/rabbitmqctl set_permissions -p '/' rabbitadmin '.*' '.*' '.*'
在宿主机上开发 5672, 15672 端口
firewall-cmd --add-port=5672/tcp --permanent firewall-cmd --add-port=15672/tcp --permanent firewall-cmd --reload