RocketMQ: how are the queues of a topic mapped to the master brokers?

611 views Asked by At

As I know, In RocketMq, a "queue" is similar as a "partition" in Kafka. One topic has multiple queues, also has multiple brokers(master and slave).

But how are the queues are mapped to the masters?

For example, if I have a topic with 3 queues, and 3 masters. The 3 queues are distributed among the 3 masters? or each master has 3 queues?

1

There are 1 answers

3
Xinyu Zhou On

You can specify the queue numbers When you create topic:

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

That means you can decide the queue numbers in any broker or cluster. More details please refer to here.