Skip to content
New issue

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

是否可以提供实例ID复用的能力 #1443

Open
colin-si opened this issue Jan 2, 2024 · 0 comments
Open

是否可以提供实例ID复用的能力 #1443

colin-si opened this issue Jan 2, 2024 · 0 comments

Comments

@colin-si
Copy link

colin-si commented Jan 2, 2024

Is your feature request related to a problem? Please describe.
当前微服务进程如果发生重启后,会重新向注册中心注册,注册中心会生成一个新的实例ID。但是在很多业务场景下,不希望每次进程重启实例ID就发生变更,希望有机制可以服务该实例之前注册过的实例ID。比如说:k8s纳管场景,业务的podName不变的情况下(这个定位信息支持业务自定义),向注册中心注册的对应的实例ID可以保持不变。

Describe the solution you'd like
注册中心可以在etcd中添加一个存储,用于标识定位信息(需要包含serviceId和业务自定义的定位信息)和instanceId的映射。这样每次当有一个新的注册请求发送到注册中心的时候(未携带instanceId),SC根据请求体中的定位信息向etcd查询是否有定位信息到instanceID的映射,如果可以查到,则说明之前有注册过,则取其instanceId进行复用;如果etcd里当前没有该映射信息,则说明之前没有人根据该定位进行进行注册,则SC新分配一个instanceID来注册使用,并且同时将定位信息和该instanceId的映射关闭写入etcd,用于下次复用。

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant