云原生之使用Docker部署RabbitMQ消息中间件
【摘要】 云原生之使用Docker部署RabbitMQ消息中间件
一、RabbitMQ介绍
1.RabbitMQ简介
RabbitMQ是使用Erlang语言来编写的,并且RabbitMQ是基于AMQP协议的。RabbitMQ是一个开源的消息代理的队列服务器,用来通过普通协议在完全不同的应用之间共享数据。
2.RabbitMQ特点
- 开源、性能优秀,稳定性保障
- 提供可靠性消息投递模式、返回模式
- 与Spring AMQP完美整合,API丰富
- 集群模式丰富,表达式配置,HA模式,镜像队列模型
- 保证数据不丢失的前提做到高可靠性、可用性
二、检查docker状态
[root@node ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2022-10-27 13:42:27 CST; 23h ago
Docs: https://docs.docker.com
Main PID: 58398 (dockerd)
Tasks: 35
Memory: 509.4M
CGroup: /system.slice/docker.service
├─58398 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
├─58997 /usr/bin/docker-proxy -proto udp -host-ip 0.0.0.0 -host-port 30000 -container-ip 172.17.0.2 -container-port 30000
├─59004 /usr/bin/docker-proxy -proto udp -host-ip :: -host-port 30000 -container-ip 172.17.0.2 -container-port 30000
├─59696 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8080 -container-ip 172.17.0.3 -container-port 8080
└─59702 /usr/bin/docker-proxy -proto tcp -host-ip :: -host-port 8080 -container-ip 172.17.0.3 -container-port 8080
Oct 27 20:12:11 node dockerd[58398]: time="2022-10-27T20:12:11.039975761+08:00" level=info msg="Download failed, retrying (3/5): Get \"https://p...
Oct 27 20:13:32 node dockerd[58398]: time="2022-10-27T20:13:32.439216385+08:00" level=info msg="Download failed, retrying (4/5): read tc...by peer"
Oct 27 20:18:35 node dockerd[58398]: time="2022-10-27T20:18:35.005006269+08:00" level=info msg="Download failed, retrying (3/5): read tc...by peer"
Oct 27 20:19:03 node dockerd[58398]: time="2022-10-27T20:19:03.572294722+08:00" level=info msg="Download failed, retrying (4/5): Get \"https://p...
Oct 27 20:30:21 node dockerd[58398]: time="2022-10-27T20:30:21.331989742+08:00" level=info msg="Download failed, retrying (4/5): read tc...by peer"
Oct 27 20:30:54 node dockerd[58398]: time="2022-10-27T20:30:54.792611068+08:00" level=info msg="Download failed, retrying (5/5): Get \"https://p...
Oct 27 20:35:45 node dockerd[58398]: time="2022-10-27T20:35:45.815030472+08:00" level=info msg="Download failed, retrying (5/5): read tc...by peer"
Oct 27 20:37:55 node dockerd[58398]: time="2022-10-27T20:37:55.378115843+08:00" level=info msg="Download failed, retrying (5/5): read tc...by peer"
Oct 27 20:45:31 node dockerd[58398]: time="2022-10-27T20:45:31.256303716+08:00" level=error msg="Download failed after 6 attempts: read ...by peer"
Oct 27 20:45:31 node dockerd[58398]: time="2022-10-27T20:45:31.257428765+08:00" level=info msg="Attempting next endpoint for pull after ...by peer"
Hint: Some lines were ellipsized, use -l to show in full.
三、下载RabbitMQ镜像
[root@node ~]# docker pull bitnami/rabbitmq
Using default tag: latest
latest: Pulling from bitnami/rabbitmq
0796bf144e3f: Pull complete
0aa278e6d559: Pull complete
f37134480d36: Pull complete
3ca5a05c65cf: Pull complete
88bb7bc42515: Pull complete
d707818752e6: Pull complete
b8a937a01956: Pull complete
efb772451b7f: Pull complete
db7fe513e59c: Pull complete
0d37a623156d: Pull complete
2e1d8d64104c: Pull complete
1bc67f22006e: Pull complete
891457114828: Pull complete
1161d96f1d40: Pull complete
Digest: sha256:a45676c71cf551fe942245b7ae133f9fd09f6278bb53fa98e18a00cf6abdbd90
Status: Downloaded newer image for bitnami/rabbitmq:latest
docker.io/bitnami/rabbitmq:latest
四、创建RabbitMQ容器
1.创建数据目录
[root@node ~]# mkdir -p /data/rabbitmq/data
[root@node ~]# chmod -R 777 /data/rabbitmq/data
2.运行RabbitMQ容器
[root@node rabbitmq]# docker run -d --name rabbitmq --restart always -v /data/rabbitmq/data:/bitnami -e RABBITMQ_USERNAME=admin -e RABBITMQ_PASSWORD=admin -p 5672:5672 -p 15672:15672 bitnami/rabbitmq:latest
9631983cebc690761d3cda187ea85383ffef0005045e7a60e4a527ceb1c419ef
3.查看RabbitMQ容器状态
[root@node rabbitmq]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9631983cebc6 bitnami/rabbitmq:latest "/opt/bitnami/script…" 18 seconds ago Up 18 seconds 4369/tcp, 5551-5552/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp rabbitmq
五、进入RabbitMQ登录页
六、登录RabbitMQ首页
【版权声明】本文为华为云社区用户原创内容,未经允许不得转载,如需转载请自行联系原作者进行授权。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)