docker-compose 安装 rabbitmq
编写 docker-compose.yml
1 | version: '3' |
参考文档:https://registry.hub.docker.com/_/rabbitmq/
浏览器访问
浏览器访问 ip:15672
即可,用户名,密码输入 root
登录。
注意
application.yml
文件中推荐为docker
容器设置hostname
,因为rabbitmq
默认使用hostname
作为存储数据的节点名,设置hostname
可以避免生成随机的节点名,方便追踪数据。官网原文如下One of the important things to note about RabbitMQ is that it stores data based on what it calls the "Node Name", which defaults to the hostname. What this means for usage in Docker is that we should specify -h/--hostname explicitly for each daemon so that we don't get a random hostname and can keep track of our data:
RABBITMQ_DEFAULT_USER
和RABBITMQ_DEFAULT_PASS
用来设置超级管理员的账号和密码,如果不设置,默认都是guest
docker
镜像使用像这样rabbitmq:3.8.3-management
带有后缀-management
的镜像,之前使用没带这个后缀的镜像,网页会访问失败。
用户设置与 virtual host 配置
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 猿来是你!
评论