一、 安装Docker

二、 安装Docker-Compose

​​docker-compose 安装​​

三、 安装RocketMQ

​​github地址​​

​​dockerhub地址​​

3.1 下载安装配置文件

$ git clone https://github.com/foxiswho/docker-rocketmq.git

3.2 移动到brokercnf文件夹下

$ cd ./docker-rocketmq/rmq/rmq/brokerconf/

3.3 修改配置文件

$ vim broker.conf

修改​​brokerIP1=192.168.25.142​​为宿主机IP,因为默认分配的Docker0的172网段,不方便外部调试

Docker安装单机RocketMQ_Docker

3.4 部署

3.4.1 移动到​​docker-compose.yml​​文件位置

$ cd ./docker-rocketmq/rmq

3.4.2 根据修改配置

vim docker-compose.yml

​docker-compose.yml​

version: '3.7'

services:
rmqnamesrv:
image: foxiswho/rocketmq:server
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- ./rmq/logs:/opt/logs
- ./rmq/store:/opt/store
environment:
JAVA_OPTS: " -Duser.home=/opt"
JAVA_OPT_EXT: "-Xms128m -Xmx128m -Xmn128m"
networks:
rmq:
aliases:
- rmqnamesrv
rmqbroker:
image: foxiswho/rocketmq:broker
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
volumes:
- ./rmq/logs:/opt/logs
- ./rmq/store:/opt/store
- ./rmq/brokerconf/broker.conf:/etc/rocketmq/broker.conf
environment:
NAMESRV_ADDR: "rmqnamesrv:9876"
JAVA_OPTS: " -Duser.home=/opt"
JAVA_OPT_EXT: "-server -Xms128m -Xmx128m -Xmn128m"
command: mqbroker -c /etc/rocketmq/broker.conf
depends_on:
- rmqnamesrv
networks:
rmq:
aliases:
- rmqbroker

rmqconsole:
image: styletang/rocketmq-console-ng
container_name: rmqconsole
ports:
- 8180:8080
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
depends_on:
- rmqnamesrv
networks:
rmq:
aliases:
- rmqconsole

networks:
rmq:
name: rmq
driver: bridge

3.4.3 运行容器

$ docker-compose -f ./docker-compose.yml up -d

3.4.4 查看容器状态

$ docker-compose -f ./docker-compose.yml ps

3.4.5 查看容器日志

$ docker-compose -f ./docker-compose.yml logs rmqnamesrv|rmqbroker|rmqconsole

四、 打开运维页面

​http://192.168.25.142:8180​

Docker安装单机RocketMQ_rmq_02