zoukankan      html  css  js  c++  java
  • docker-compose安装rabbitmq

    编写时间:2020-05-08

    参考文档:docker安装rabbitmq

    1. 编写docker-compose.yml

    version: '3'
    services:
      rabbitmq:
        image: rabbitmq:3.8.3-management
        container_name: rabbitmq
        restart: always
        hostname: myRabbitmq
        ports:
          - 15672:15672
          - 5672:5672
        volumes:
          - ./data:/var/lib/rabbitmq
        environment:
          - RABBITMQ_DEFAULT_USER=root
          - RABBITMQ_DEFAULT_PASS=root

    2. 浏览器访问 ip:15672即可,用户名,密码输入root登录。

    注意:

    1. 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:

    2. RABBITMQ_DEFAULT_USER  和  RABBITMQ_DEFAULT_PASS 用来设置超级管理员的账号和密码,如果不设置,默认都是 guest

    3.  docker镜像使用像这样 rabbitmq:3.8.3-management  带有后缀 -management的镜像,之前使用没带这个后缀的镜像,网页访问失败,如下图。

    3. 用户设置与virtual host配置(参考文档)

     
     
  • 相关阅读:
    软件项目管理阅读笔记02
    大二下周总结(11)
    “帮你APP”团队冲刺9
    “帮你APP”团队冲刺8
    “帮你APP”团队冲刺7
    “帮你APP”团队冲刺6
    “帮你APP”团队冲刺5
    单词统计
    “帮你APP”团队冲刺4
    “帮你APP”团队冲刺3
  • 原文地址:https://www.cnblogs.com/yloved/p/12853029.html
Copyright © 2011-2022 走看看