Mac Docker安装RabbitMQ
2021-05-11 本文已影响0人
Geroge1226
参考:https://blog.csdn.net/qq_34775355/article/details/108305396
1、说明
常见的MQ 消息队列有很多种类,这里在mac上安装的RabbitMQ
,安装方式也有很多种Docker
方式、yum
方式、homebrew
方式,这里选择Docker方式。
2、安装过程
- 拉取rabbitmq镜像,终端执行:
docker pull rabbitmq
latest: Pulling from library/rabbitmq
01bf7da0a88c: Pull complete
f3b4a5f15c7a: Pull complete
57ffbe87baa1: Pull complete
5ef3ef76b1b5: Pull complete
e9f255817d55: Pull complete
13dc549f3930: Pull complete
a895181f23e6: Pull complete
3d373f7d2d0c: Pull complete
37bf565e5165: Pull complete
e8847c14de68: Pull complete
Digest: sha256:bab178419907cdbc561c0222ac4cdbbbdea2d390dab0a84d7972be3bdb537d13
Status: Downloaded newer image for rabbitmq:latest
docker.io/library/rabbitmq:latest
- 启动rabbitmq,终端输入:
docker run -d --hostname my-rabbit --name rabbit -p 15672:15672 -p 5672:5672 rabbitmq
- 安装rabbitmq management管理插件
docker ps
docker exec -it 镜像ID /bin/bash
rabbitmq-plugins enable rabbitmq_management
说明:
①先执行docker ps 拿到当前的镜像ID
[lonyang@lsyPro /etc ]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
602d494c79e0 rabbitmq "docker-entrypoint.s…" About a minute ago Up About a minute 4369/tcp, 0.0.0.0:5672->5672/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbit
②进入容器,安装插件
[longshiyang@lsyPro /etc ]$ docker exec -it 602d494c79e0 /bin/bash
root@my-rabbit:/# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@my-rabbit:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_prometheus
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@my-rabbit...
The following plugins have been enabled:
rabbitmq_management
-
ctrl+p+q退出当前容器
-
浏览器输入:localhost: 15672
image.png