Skip to content

建议支持跨数据中心 ID 唯一性, 目前的雪花ID是不支持的 #773

@digyear

Description

@digyear

Is your feature request related to a problem? Please describe.
场景: 多个数据中心(跨州际)部署相同的服务,使用雪花ID , 采用 redis 分发机器号,但是每个数据中心都独立的 redis
问题: 这种场景下 CosId 基于 redis 生成的 machineId 都是从 0 开始的, 无法保证全球 ID 的唯一性。 配置 namespace 的方法试过了,但是没什么效果。
ps: 这种场景下重复其实也没有太大关系, 但是还是期望可以做到不重复

Describe the solution you'd like
希望加入数据中心配置项,可配置不同的数据中心 Id,实现跨数据中心 ID 唯一性。
我目前的做法是继承了 SpringRedisMachineIdDistributor 类, 重写了 distributeRemote 方法,
从 machineId 中拿出3位作为数据中心标识, 可以支持 8 个数据中心,一般也够用了。

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions