1、配置文件准备
1.1、 新建目录:/home/docker/data/rocketmq/conf
mkdir /home/docker/data/rocketmq/conf
1.2、 在上面目录下新建文件broker.conf文件,内容如下
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
# 主机IP
brokerIP1 = 192.168.17.173
2、创建目录并赋权
mkdir -p /home/docker/data/rocketmq/data
3、编辑docker-compose-rocketmq.yml文件
进入/home/docker目录,新建docker-compose-rocketmq.yml文件,内容如下:
version: '3'
services:
namesrv:
image: rocketmqinc/rocketmq
container_name: rmqnamesrv
ports:
- 9876:9876
volumes:
- /home/docker/data/rocketmq/logs:/home/rocketmq/logs
- /home/docker/data/rocketmq/store:/home/rocketmq/store
command: sh mqnamesrv
broker:
image: rocketmqinc/rocketmq
container_name: rmqbroker
ports:
- 10909:10909
- 10911:10911
- 10912:10912
volumes:
- /home/docker/data/rocketmq/logs:/home/rocketmq/logs
- /home/docker/data/rocketmq/store:/home/rocketmq/store
- /home/docker/data/rocketmq/conf/broker.conf:/opt/rocketmq/conf/broker.conf
command: sh mqbroker -n namesrv:9876 -c /home/docker/data/rocketmq/conf/broker.conf
depends_on:
- namesrv
environment:
- JAVA_HOME=/usr/lib/jvm/jre
console:
image: styletang/rocketmq-console-ng
container_name: rocketmq-console-ng
ports:
- 8087:8080
depends_on:
- namesrv
environment:
- JAVA_OPTS= -Dlogging.level.root=info -Drocketmq.namesrv.addr=rmqnamesrv:9876
- Dcom.rocketmq.sendMessageWithVIPChannel=false
4、启动Rocketmq
docker-compose -f docker-compose-rocketmq.yml up -d
5、效果展示
浏览器访问:http://192.168.17.173:8087/#/,效果图如下,至此,docker compose 搭建Rocketmq完成文章来源:https://www.toymoban.com/news/detail-697544.html
文章来源地址https://www.toymoban.com/news/detail-697544.html
到了这里,关于Docker实战:docker compose 搭建Rocketmq的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!