RabbitMQ 安装
# Docker 安装 RabbitMQ (带管理后台的)
docker pull rabbitmq:3.10.1-management
docker run -di --name rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 rabbitmq:management
1
2
3
2
3
# Docker Compose 安装
注意: 在宿主机新建/data/rabbitmq目录并且 chmod 777, 否则会导致启动失败
新建 rabbitmq-single.yml 配置文件内容为:
version: '3.9'
services:
rabbitmq:
image: rabbitmq:3.10.1-management
restart: always
# 15672 是管理后台端口 5672 是 rabbitMQ 端口
ports:
- "15672:15672"
- "5672:5672"
container_name: rabbitmq
hostname: rabbitmq
networks:
- front-ms
environment:
RABBITMQ_DEFAULT_USER: admin
RABBITMQ_DEFAULT_PASS: admin
volumes:
- $PWD/data/rabbitmq:/var/lib/rabbitmq
# 网络
networks:
front-ms:
driver: bridge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
docker-compose 启动指令为
docker-compose -f rabbitmq-single.yml up -d
1
大概这样子就是启动完成
[root@bulk rabbitmq]# docker-compose -f rabbitmq-single.yml up -d
Creating network "rabbitmq_front-ms" with driver "bridge"
Pulling rabbitmq (rabbitmq:3.10.1-management)...
3.10.1-management: Pulling from library/rabbitmq
d5fd17ec1767: Pull complete
921d0bdeed9f: Pull complete
ffce2faba222: Pull complete
9b507bebfd9c: Pull complete
50373b998ba2: Pull complete
81ed326ef9ae: Pull complete
9fb0c5ab4d64: Pull complete
223b630d014f: Pull complete
e2b34a83aefd: Pull complete
39158ded6636: Pull complete
Digest: sha256:a05c3f8bf17da49fdef8d3e0c89900a443ee1523aeb5c7d0ec17363fe0689c45
Status: Downloaded newer image for rabbitmq:3.10.1-management
Creating rabbitmq ... done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 验证是否安装成功
访问: 宿主机ip:15672(比如:192.163.103.10:15672) , 进入后台页面, 账号为 admin , 密码为 admin
能成功进入页面,一般就是部署成功了
上次更新: 2023/02/08, 16:08:26