We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
生产上用snowflake模式,目前要做部署第二个机房做多活,想在新的机房独立部署一套leaf(两个机房物理位置很远,网络延迟不可控,担心新机房的leaf向老机房的zk注册,及做心跳检测时会出问题), 两套服务同时工作,会不会因为workid相同,生成相同的id?
The text was updated successfully, but these errors were encountered:
如果不是同的zk,肯定会有相同的概率。因为不是的zk,workerId有可能是相同的。这是雪花算法的原理造成的。建议还是向同一进行zk注册。
Sorry, something went wrong.
可以加前缀
通常不同机房,都应该设置不同workerId,
不同机房(zk也不同)workid可以做偏移啊。我这目前改了下代码,支持配置文件里面配置偏移量;目前机房2的偏移200, 假设机房2的workid从zk上获取到的是1,那么真实使用时用的就是201。考虑到机房1的id服务的最大workid都不会到200, 因此不会有重复问题
No branches or pull requests
生产上用snowflake模式,目前要做部署第二个机房做多活,想在新的机房独立部署一套leaf(两个机房物理位置很远,网络延迟不可控,担心新机房的leaf向老机房的zk注册,及做心跳检测时会出问题), 两套服务同时工作,会不会因为workid相同,生成相同的id?
The text was updated successfully, but these errors were encountered: