docker-compose.yml
rocketMQ 单机部署:
docker-compose.yml
version: "3.0"
services:
rocketmqNameServer:
image: rocketmqinc/rocketmq
container_name: rocketmqNameServer
#restart: always
volumes:
#挂载路径,冒号左边为服务器本地路径,冒号右边为容器内部路径
- ./nameServer/logs:/root/logs
- ./nameServer/store:/root/store
environment:
MAX_POSSIBLE_HEAP: 100000000
command:
# 服务启动
sh mqnamesrv
#network_mode: host
ports:
- "9876:9876"
rocketmqBroker:
image: rocketmqinc/rocketmq
container_name: rocketmqBroker
#restart: always
volumes:
#挂载路径,冒号左边为服务器本地路径,冒号右边为容器内部路径
- ./broker/logs:/root/logs
- ./broker/store:/root/store
- ./broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf
links:
- rocketmqNameServer:namesrv
environment:
NAMESRV_ADDR: namesrv:9876
MAX_POSSIBLE_HEAP: 200000000
command:
# 服务启动
sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf
#network_mode: host
ports:
- "10911:10911"
- "10909:10909"
rocketmqConsole:
image: pangliang/rocketmq-console-ng
container_name: rocketmqConsole
links:
- rocketmqNameServer:namesrv
environment:
JAVA_OPTS: "-Drocketmq.namesrv.addr=namesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
#network_mode: host
ports:
- "19999:8080"
broker.conf
# 所属集群名称,如果节点较多可以配置多个
brokerClusterName = DefaultCluster
#broker名称,master和slave使用相同的名称,表明他们的主从关系
brokerName = broker-a
#0表示Master,大于0表示不同的slave
brokerId = 0
#表示几点做消息删除动作,默认是凌晨4点
deleteWhen = 04
#在磁盘上保留消息的时长,单位是小时
fileReservedTime = 48
#有三个值:SYNC_MASTER,ASYNC_MASTER,SLAVE;同步和异步表示Master和Slave之间同步数据的机制;
brokerRole = ASYNC_MASTER
#刷盘策略,取值为:ASYNC_FLUSH,SYNC_FLUSH表示同步刷盘和异步刷盘;SYNC_FLUSH消息写入磁盘后才返回成功状态,ASYNC_FLUSH不需要;
flushDiskType = ASYNC_FLUSH
# 设置broker节点所在服务器的ip地址
brokerIP1 = 192.168.30.200
# 磁盘使用达到95%之后,生产者再写入消息会报错 CODE: 14 DESC: service not available now, maybe disk full
diskMaxUsedSpaceRatio=95
评论
0 评论