Docker
https://hub.docker.com/_/rabbitmq
$ docker run -d --hostname my-rabbit --name rabbit-5672 rabbitmq:management-alpine
# Unavailable in 3.9 and up
RABBITMQ_DEFAULT_PASS_FILE
RABBITMQ_DEFAULT_USER_FILE
RABBITMQ_MANAGEMENT_SSL_CACERTFILE
RABBITMQ_MANAGEMENT_SSL_CERTFILE
RABBITMQ_MANAGEMENT_SSL_DEPTH
RABBITMQ_MANAGEMENT_SSL_FAIL_IF_NO_PEER_CERT
RABBITMQ_MANAGEMENT_SSL_KEYFILE
RABBITMQ_MANAGEMENT_SSL_VERIFY
RABBITMQ_SSL_CACERTFILE
RABBITMQ_SSL_CERTFILE
RABBITMQ_SSL_DEPTH
RABBITMQ_SSL_FAIL_IF_NO_PEER_CERT
RABBITMQ_SSL_KEYFILE
RABBITMQ_SSL_VERIFY
RABBITMQ_VM_MEMORY_HIGH_WATERMARK
$ docker run -d --hostname my-rabbit --name rabbit-5672 -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin rabbitmq:management-alpine
Docker Compose
version: "1"
services:
rabbitmq:
image: rabbitmq:management-alpine
ports:
- 5672:5672
- 15672:15672
volumes:
- "/home/docker-mount/rabbitmq:/var/lib/rabbitmq"
restart: always
container_name: rabbitmq-5672
networks:
springcloud-overlay:
aliases:
- rabbitmq-server
使用 Docker Compose 启动:
docker-compose -f rabbitmq-compose.yml up -d
docker ps -a
docker logs -f rabbitmq-5672
添加延迟插件、配置账号密码
进入镜像添加延迟插件:
# 查找镜像列表
docker ps -a
# 拷贝插件到镜像目录下
docker cp rabbitmq_delayed_message_exchange-20171201-3.7.x.ez 0030898e3538:/plugins
# 启动插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
rabbitmq-plugins enable rabbitmq_shovel rabbitmq_shovel_management
进入镜像添加用户:
docker exec -it rabbitmq-5672 bash
# 新增用户admin
rabbitmqctl add_user admin admin
# 分配超级管理员权限
rabbitmqctl set_user_tags admin administrator
# 退出容器
exit
# 重启容器
docker restart rabbitmq-5672
使用 admin:admin 访问 http://localhost:15672
给admin设置权限
作者:Jeebiz 创建时间:2023-03-23 15:16
最后编辑:Jeebiz 更新时间:2024-11-01 10:06
最后编辑:Jeebiz 更新时间:2024-11-01 10:06