Closed
Description
BUG REPORT
- Please describe the issue you observed:
docker环境下,2个不同的consumer实例,生成的clientId是重复的,进而导致rebalance的结果混乱。(经过debug发现获取到的ip是一样的,怀疑跟rancher网络有关)
- Please tell us about your environment:
rocketmq client "4.3.0"
java version "1.8.0_181"
Docker version "18.09.0"
- Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
建议:改进ClientConfig类中instanceName的生成规则
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
[-]在docker环境下,consumer端rebalance发生混乱[/-][+]Consumer rebalance problem when using docker container[/+]huanwei commentedon Jan 9, 2019
What's the current clientId generation rule in ClientConfig class? And how to reproduce it?
vancefantasy commentedon Jan 12, 2019
@huanwei
clientId:
instanceName:
在docker环境下(使用host模式),获取到的clientIp和pid都是一样的。当然clientIp一样的确切原因还没完全确认,可能和引入Rancher有关。
#668
caigy commentedon May 21, 2019
I encountered the same problem. Under HOST networking mode, all dockers managed by Rancher are with the same docker0 IP, which is 172.17.0.1. Thus, RemotingUtil.getLocalAddress() always returns "172.17.0.1" for those dockers, which leads to collision between consumers with the same pid, if using default "IP@pid" clientId.
vongosling commentedon May 22, 2019
@huanwei This is a known problem in the docker container if we deploy mutl-docker containers in the one machine.
duhenglucky commentedon May 22, 2019
@caigy @huanwei if used Rancher to manage container, all docker will always return "172.17.0.1" when getLocalAddress, not only in bridge model, but also in host model, so I think it may be an issue caused by Rancher, so you can temporarily solve this problem by setting the instanceName.
huanwei commentedon May 22, 2019
That's known issue caused by Rancher container network. Setting different instanceName should solve this problem, just as @duhenglucky suggested.
haycco commentedon Jul 1, 2019
Which version have been solved, I also meeting the same problem.
maixiaohai commentedon Jan 19, 2021
Has this be fixed?
Aaron-TangCode commentedon Jan 7, 2022
除了通过手动自定义instanceName外,RocketMQ会做什么来兼容吗?还是不考虑兼容了?
Git-Yang commentedon Jan 8, 2022
I would like a more general way to completely solve the problem of instance conflicts. #3680