由RocketMQ官方包打包,版本为rocketmq:4.3.1(压缩包下载地址)
单机
broker-a-m:
image: registry.cn-hangzhou.aliyuncs.com/leonardo/rocketmq-broker:4.3.1
container_name: broker-a-m
hostname: broker-a-m
restart: always
ports:
- "10909:10909"
networks:
- "leonardo"
depends_on:
- "namesrv"
volumes:
- "/usr/local/docker/rockermq/logs/broker/a-m:/opt/logs"
- "/usr/local/docker/rockermq/store/broker/a-m:/opt/store"
- "/usr/local/docker/rockermq/data/broker/a-m:/opt/data"
- "/usr/local/docker/rockermq/config/broker/a-m:/opt/conf"
- "/etc/localtime:/etc/localtime"
集群
broker-a-m:
image: registry.cn-hangzhou.aliyuncs.com/leonardo/rocketmq-broker:4.3.1
container_name: broker-a-m
hostname: broker-a-m
restart: always
ports:
- "10909:10909"
networks:
- "leonardo"
depends_on:
- "namesrv"
volumes:
- "/usr/local/docker/rockermq/logs/broker/a-m:/opt/logs"
- "/usr/local/docker/rockermq/store/broker/a-m:/opt/store"
- "/usr/local/docker/rockermq/data/broker/a-m:/opt/data"
- "/usr/local/docker/rockermq/config/broker/a-m:/opt/conf"
- "/etc/localtime:/etc/localtime"
broker-a-s:
image: registry.cn-hangzhou.aliyuncs.com/leonardo/rocketmq-broker:4.3.1
container_name: broker-a-s
hostname: broker-a-s
networks:
- "leonardo"
depends_on:
- "namesrv"
restart: always
ports:
- "10911:10911"
volumes:
- "/usr/local/docker/rockermq/logs/broker/a-m:/opt/logs"
- "/usr/local/docker/rockermq/store/broker/a-m:/opt/store"
- "/usr/local/docker/rockermq/data/broker/a-m:/opt/data"
- "/usr/local/docker/rockermq/config/broker/a-s:/opt/conf"
- "/etc/localtime:/etc/localtime"
配置文件说明broker.properties
1.a-m
# 所属集群名字
brokerClusterName=leonardo-rocketmq-cluster
# broker名字,注意此处不同的配置文件填写的不一样
brokerName=broker-a
# nameServer 地址,分号分割
namesrvAddr=namesrv:9876
# 0 表示Master(主), > 0 表示slave(从)
brokerId=0
# Broker 对外服务的监听端口
listenPort=10909
#多网卡机器配置IP地址
brokerIP1=192.168.56.103
# 删除文件时间点,默认是凌晨4点
deleteWhen=04
# 文件保留时间,默认48小时
fileReservedTime=72
#角色
brokerRole=ASYNC_MASTER
#存储路径
storePathRootDir=/opt/store
#commitLog存储路径
storePathCommitLog=/opt/store/commitlog
# 在发送消息时,自动创建服务器不存在的Topic,默认创建的队列数
defaultTopicQueueNums=4
# 是否允许Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=true
# 是否允许Broker自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=true
# 刷盘方式
# - ASYNC_FLUSH 异步刷盘
# - SYNC_FLUSH 同步刷盘
flushDiskType=ASYNC_FLUSH
2.a-s
# 所属集群名字
brokerClusterName=leonardo-rocketmq-cluster
# broker名字,注意此处不同的配置文件填写的不一样
brokerName=broker-a
# nameServer 地址,分号分割
namesrvAddr=namesrv:9876
# 0 表示Master(主), > 0 表示slave(从)
brokerId=1
# Broker 对外服务的监听端口
listenPort=10911
#多网卡机器配置IP地址
brokerIP1=192.168.56.103
# 删除文件时间点,默认是凌晨4点
deleteWhen=04
# 文件保留时间,默认48小时
fileReservedTime=72
#角色
brokerRole=SLAVE
#存储路径
storePathRootDir=/opt/store
#commitLog存储路径
storePathCommitLog=/opt/store/commitlog
# 在发送消息时,自动创建服务器不存在的Topic,默认创建的队列数
defaultTopicQueueNums=4
# 是否允许Broker 自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=false
# 是否允许Broker自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=false
# 刷盘方式
# - ASYNC_FLUSH 异步刷盘
# - SYNC_FLUSH 同步刷盘
flushDiskType=ASYNC_FLUSH