rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

clsuterList command get wrong result when different cluster with same name server and same brokerName

Open superheizai opened this issue 7 years ago • 10 comments

image

  1. firstly, create broker-a.properties

brokerClusterName=DefaultCluster brokerName=broker-a brokerId=0 deleteWhen=04 fileReservedTime=48 listenPort=10911 namesrvAddr=localhost:9876 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH

startup with broker-a.properties, we can see the right output.

  1. secondly, create broker-b.properties brokerClusterName=DefaultCluster1 brokerName=broker-a brokerId=0 deleteWhen=04 fileReservedTime=48 listenPort=10921 namesrvAddr=localhost:9876 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH storePathRootDir=~/rocketmq/data/store storePathCommitLog=~/rocketmq/data/store/commitlog storePathIndex=~/rocketmq/data/store/index storePathConsumeQueue=~/rocketmq/data/store/consumequeue

then ClusterList give two broker both with 10921 port

superheizai avatar Sep 10 '19 16:09 superheizai

Furthormore, under this situation, I create the topic to DefaultCluster1, the topic would be created to DefaultCluster. image

superheizai avatar Sep 10 '19 16:09 superheizai

@superheizai plz check your brokerId config in broker.conf is right.

duhenglucky avatar Sep 12 '19 09:09 duhenglucky

I have named different cluster name for these two broker with same brokerId. Do you mean even in different cluster, they should be with different brokerId?

superheizai avatar Sep 12 '19 13:09 superheizai

@duhenglucky This could be a bug. In the first picture, which show the same IP:port in different cluster. As I think, this could't happen at any case.

superheizai avatar Sep 16 '19 10:09 superheizai

在nameServer中,一个broker名字对应一个BrokerData,BrokerData拥有一个clusterName private final HashMap<String/* brokerName */, BrokerData> brokerAddrTable; 所以你要改名 @superheizai

CodeIngL avatar Oct 06 '19 09:10 CodeIngL

@CodeIngL , I know how to resolve the problem. What I want to know is if this result is RocketMQ wanted, or if this is a bug.

superheizai avatar Oct 06 '19 13:10 superheizai

请看BrokerData应该可以非常简单理解设计。 @superheizai

CodeIngL avatar Oct 08 '19 09:10 CodeIngL

This is an interesting issue. I suppose we need more discussion on it. Since we use brokerName as the key of brokerAddrTable: private final HashMap<String/* brokerName */, BrokerData> brokerAddrTable; if two clusters have brokers with the same brokerName, when broker registers itself to nameserver, it will overwrite previous one and the previous one will overwrite it again by next registration. So the brokerAddrTable of namesever is uncertain and that is the reason the topic was created onto the cluster you didn't want. IMO, the questions @superheizai raised MAY need to be enhanced though we can avoid it by setting totally different brokerNames for different clusters like below: 1. brokerClusterName=DefaultCluster brokerName=broker-a 2. brokerClusterName=DefaultCluster brokerName=broker-b 3. brokerClusterName=DefaultCluster1 brokerName=broker-c 4. brokerClusterName=DefaultCluster1 brokerName=broker-d

@zongtanghu @duhenglucky What do u think?

xiangwangcheng avatar Oct 25 '19 08:10 xiangwangcheng

This issue is stale because it has been open for 365 days with no activity. It will be closed in 3 days if no further activity occurs.

github-actions[bot] avatar Oct 03 '22 00:10 github-actions[bot]

This issue was closed because it has been inactive for 3 days since being marked as stale.

github-actions[bot] avatar Oct 07 '22 00:10 github-actions[bot]