1

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?

travi
  • 21
  • 1

1 Answers1

1

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.

Xinyu Zhou
  • 48
  • 4
  • but how the queues are mapped to masters in the implementation? I have read the source code and found that the admin console will send the topic to all the masters when creating a topic, but how the masters divide the queues of a topic? – travi Jan 10 '17 at 06:24
  • Use `-b` to create topic in specified broker, and use `-r` or `-w` to specific the read or write queue nums. – Xinyu Zhou Jan 16 '17 at 04:25
  • by the way, I have solved this problem by reading the source code. http://blog.csdn.net/chunlongyu/article/category/6638499 – travi Jan 17 '17 at 12:11