RocketMQ broker配置参数

RocketMQ broker配置参数

上一篇介绍了rocketmq docker版部署的方法和启动命令,这里介绍一下rocketmq broker的配置参数。
集群配置broker分布如下:

机器IP broker name
10.190.1.1 broker-a,broker-b-s
10.190.1.2 broker-b,broker-a-s

以broker-a.properties为例,broker-a-s需要修改ip和brokerId=1,brokerName=broker-a不需要修改。

#集群名称
brokerClusterName=DefaultCluster
#broker名称
brokerName=broker-a
#对外网暴露的IP地址
brokerIP1=10.190.1.1
brokerIP2=10.190.1.1
# 0为master, 1是slave
brokerId=0
namesrvAddr=10.190.1.1:9876;10.190.1.2:9876
#默认的Topic队列数
defaultTopicQueueNums=4
#自动创建Topic,建议线上关闭,线下开启
autoCreateTopicEnable=false
#自动创建订阅组,建议线上关闭,线下开启
autoCreateSubscriptionGroup=true
#broker对外服务监听端口
listenPort=10911
#默认0时删除文件
deleteWhen=00
#文件保留120小时
fileReservedTime=120
#commitLog default size=1G
#mapedFileSizeCommitLog=1073741824
#ConsumeQueue per file=30W
#mapedFileSizeConsumeQueue=300000
#destroyMapedFileIntervalForcibly=120000
#redeleteHangedFileInterval=120000
#物理磁盘最大利用百分比,超过则报警
#diskMaxUsedSpaceRatio=88
#store path
storePathRootDir=/opt/volumes/rocketmq/broker-a/store
#commitLog path
storePathCommitLog=/opt/volumes/rocketmq/broker-a/store/commitlog
#consumer path
storePathConsumeQueue=/opt/volumes/rocketmq/broker-a/store/consumequeue
#index path
storePathIndex=/opt/volumes/rocketmq/broker-a/store/index
#checkpoint file path
storeCheckpoint=/opt/volumes/rocketmq/broker-a/store/checkpoint
#abort path
abortFile=/opt/volumes/rocketmq/broker-a/store/abort
maxMessageSize=65536
#flushCommitLogLeastPages=4
#flushConsumeQueueLeastPages=2
#flushCommitLogThoroughInterval=10000
#flushConsumeQueueThoroughInterval=60000
# Broker role 
#-ASYNC_MASTER 异步复制Master   - SYNC_MASTER 同步双写Master
brokerRole=SYNC_MASTER
flushDiskType=SYNC_FLUSH
#checkTransactionMessageEnable=false
#sendMessageThreadPoolNums=128
#pullMessageThreadPoolNums=128
#磁盘满、且无过期文件情况下 TRUE 表示强制删除文件,优先保证服务可用;FALSE 标记服务不可用,文件 不删除 
cleanFileForciblyEnable=true

autoCreateTopicEnable=false 重点提一下,如果设置不自动创建topic,那么就要手动创建topic,否则会出现no router的error。本地部署版的rocketmq的bin目录下有mqadmin工具,命令如下:

./mqadmin updateTopic -n ${HOSTNAME}:9876 -t topicName -c DefaultCluster -r 8 -w 8

附上使用方法如下:

usage: mqadmin updateTopic -b  | -c   [-h] [-n ] [-o ] [-p ] [-r ] [-s ] -t
        [-u ] [-w ]
 -b,--brokerAddr        create topic to which broker
 -c,--clusterName       create topic to which cluster
 -h,--help                   Print help
 -n,--namesrvAddr       Name server address list, eg: 192.168.0.1:9876;192.168.0.2:9876
 -o,--order             set topic's order(true|false)
 -p,--perm              set topic's permission(2|4|6), intro[2:W 4:R; 6:RW]
 -r,--readQueueNums     set read queue nums
 -s,--hasUnitSub        has unit sub (true|false)
 -t,--topic             topic name
 -u,--unit              is unit topic (true|false)
 -w,--writeQueueNums    set write queue nums

如果有console页面,也可以页面创建,BROKER_NAME要选broker-a和broker-b,否则消息会只发到一个broker上,就失去双主双从搭建的意义了。
RocketMQ broker配置参数_第1张图片

你可能感兴趣的:(笔记,linux,devops)