Featured image of post RabbitMq环境搭建

RabbitMq环境搭建

基于Docker的RabbitMq环境搭建,以及开启mqtt消息队列

常规Docker容器创建

1.查找镜像

1
docker search rabbitmq:management

2.拉取镜像

1
docker pull rabbitmq:management

3.运行Rabbitmq

1
docker run -d --restart=always --name rabbitmq -p 15672:15672 -p 5672:5672 -p 1883:1883 -p 15675:15675 rabbitmq:management

4.进入到容器内部

1
docker exec -it eb2a35ffe5f5 /bin/bash

5.开启插件

1
2
rabbitmq-plugins enable rabbitmq_mqtt
rabbitmq-plugins enable rabbitmq_web_mqtt

6.重启容器

1
docker restart eb2a35ffe5f5

6.进入Rabbitmq Web配置页面

http://localhost:15672/

  • username: guest
  • password: guest

采用docker-compose.yml文件创建容器

1.docker-compose.yml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
version: "3"

services:
  rabbitmq:
    image: rabbitmq:management
    container_name: rabbitmq
    restart: always
    ports:
      - 15671:15671
      - 25672:25672
      - 15672:15672
      - 15675:15675
      - 4369:4369
      - 5671:5671
      - 5672:5672
      - 1883:1883
    environment:
      RABBITMQ_DEFAULT_VHOST: '/'
      RABBITMQ_DEFAULT_USER: admin
      RABBITMQ_DEFAULT_PASS: admin
      TZ: Asia/Shanghai

2.docker-compose up

1
docker-compose -f .\docker-compose.yml up -d

3.进入到容器内部

1
docker exec -it eb2a35ffe5f5 /bin/bash

4.开启插件

1
2
rabbitmq-plugins enable rabbitmq_mqtt
rabbitmq-plugins enable rabbitmq_web_mqtt

5.重启容器

1
docker restart eb2a35ffe5f5

6.进入RabbitmqWeb配置页面

http://localhost:15672/

  • username: admin
  • password: admin
YukiTechSoftware
Built with Hugo
Theme Stack designed by Jimmy