docker安装并运行rabbitmq的实例代码

时间:2021-05-02

拉取镜像:

? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 [mall@vm_0_7_centos ~]$ sudo docker pull rabbitmq:3.7.15 [sudo] password for mall: 3.7.15: pulling from library/rabbitmq 5b7339215d1d: pull complete 14ca88e9f672: pull complete a31c3b1caad4: pull complete b054a26005b7: pull complete eef17c6cb6cf: pull complete d5a267fdfe2c: pull complete d499647c68af: pull complete ad88e7bd384a: pull complete ae1d871f3f62: pull complete 7ceac8eb91d4: pull complete digest: sha256:78dff08cefc9fef5c9cbaabab99d783d72d37cb7bbb66a08c4f59877ef406c1f status: downloaded newer image for rabbitmq:3.7.15 docker.io/library/rabbitmq:3.7.15

启动容器中的rabbitmq:

? 1 2 3 4 5 [mall@vm_0_7_centos ~]$ sudo docker run -d --name rabbitmq \ > --publish 5671:5671 --publish 5672:5672 --publish 4369:4369 \ > --publish 25672:25672 --publish 15671:15671 --publish 15672:15672 \ > rabbitmq:3.7.15 da8896bb8f5acc5231c636f58e26109b9c59f9b6cb3bf7359343f5c5093765ce

进入容器,开启管理功能:

? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 [mall@vm_0_7_centos ~]$ sudo docker exec -it rabbitmq /bin/bash root@da8896bb8f5a:/# rabbitmq-plugins enable rabbitmq_management enabling plugins on node rabbit@da8896bb8f5a: rabbitmq_management the following plugins have been configured: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch applying plugin configuration to rabbit@da8896bb8f5a... the following plugins have been enabled: rabbitmq_management rabbitmq_management_agent rabbitmq_web_dispatch started 3 plugins.

打开浏览器,输入本机ip和15672端口:

使用默认账户密码guest/guest登陆,后新增用户mall/mall:

新增虚拟主机:

配置虚拟主机/mall给mall用户,点击下图红框中的mall进去设置:

以上就是本次介绍的全部知识点内容,感谢大家的学习和对服务器之家的支持。

原文链接:https://www.cnblogs.com/wuxun1997/p/11770376.html

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章