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

support multi register and discovery both to nacos and polaris #658

Closed
andrewshan opened this issue Oct 21, 2022 · 10 comments
Closed

support multi register and discovery both to nacos and polaris #658

andrewshan opened this issue Oct 21, 2022 · 10 comments
Labels
enhancement New feature or request
Milestone

Comments

@andrewshan
Copy link
Collaborator

What is the feature you want to add?
support nacos and polaris discovery and register, similar to this feature: https://github.com/Tencent/spring-cloud-tencent/wiki/Multi-registration-and-multi-discovery

Why do you want to add this feature?
a mass percent of developers in spring cloud using nacos as registry, they want to transfer to polaris governance smoothly.

How to implement this feature?

  1. make polaris-java support nacos
  2. transfer the nacos configuration into polaris-java configuration to active nacos registry

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

@andrewshan andrewshan added the enhancement New feature or request label Oct 21, 2022
@lingxiao-wu
Copy link
Contributor

这个任务我可以试试,polaris-java支持nacos目前基于哪个分支开发啊?

@chuntaojun
Copy link
Contributor

chuntaojun commented Oct 22, 2022

这个任务我可以试试,polaris-java支持nacos目前基于哪个分支开发啊?

社区已经有相关的 PR 在处理了,SCT 这里应该是后续需要升级对应的 polaris-java 依赖以及整理相关使用文档

@SkyeBeFreeman SkyeBeFreeman added this to the 1.9.0 milestone Nov 1, 2022
@andrewshan
Copy link
Collaborator Author

andrewshan commented Nov 1, 2022

关于NACOS-GROUP的处理

SDK:

  • 服务名:group__service(北极星) = group, service(nacos)
  • 服务名:service(北极星) = DEFAULT_GROUP, service(nacos)

SCT:

SCT从nacos的配置(spring.cloud.nacos.discovery.group)中读取GROUP:

  • 假如GROUP为空或者为DEFAULT:传入服务名与现有逻辑一致,不拼接
  • 假如GROUP为其他,则传入服务名为group__service

关于NACOS-CLUSTER的处理

SDK:

Java SDK从实例metadata中获取internal-nacos-cluster的值,假如存在,则作为实例的CLUSTER注册

SCT:

SCT从nacos配置(spring.cloud.nacos.discovery.cluster-name)中读取集群名:

  • 假如集群名为空,则不填入
  • 假如不为空,则设置为internal-nacos-cluster的metadata的值。

@SkyeBeFreeman
Copy link
Collaborator

这个任务我可以试试,polaris-java支持nacos目前基于哪个分支开发啊?

@lingxiao-wu 1.10.0-SNAPSHOT

@lingxiao-wu
Copy link
Contributor

这个任务我可以试试,polaris-java支持nacos目前基于哪个分支开发啊?

@lingxiao-wu 1.10.0-SNAPSHOT

好的,我拉取完研究一下

@lingxiao-wu
Copy link
Contributor

关于NACOS-GROUP的处理

SDK:

  • 服务名:group__service(北极星) = group, service(nacos)
  • 服务名:service(北极星) = DEFAULT_GROUP, service(nacos)

SCT:

SCT从nacos的配置(spring.cloud.nacos.discovery.group)中读取GROUP:

  • 假如GROUP为空或者为DEFAULT:传入服务名与现有逻辑一致,不拼接
  • 假如GROUP为其他,则传入服务名为group__service

关于NACOS-CLUSTER的处理

SDK:

Java SDK从实例metadata中获取internal-nacos-cluster的值,假如存在,则作为实例的CLUSTER注册

SCT:

SCT从nacos配置(spring.cloud.nacos.discovery.cluster-name)中读取集群名:

  • 假如集群名为空,则不填入
  • 假如不为空,则设置为internal-nacos-cluster的metadata的值。

我按照规则拼接完发现sdk没有将group和service拆开,nacos依旧注册到了DEFAULT_GROUP
image
image

image

这是符合预期的吗

@chuntaojun
Copy link
Contributor

关于NACOS-GROUP的处理

SDK:

  • 服务名:group__service(北极星) = group, service(nacos)
  • 服务名:service(北极星) = DEFAULT_GROUP, service(nacos)

SCT:
SCT从nacos的配置(spring.cloud.nacos.discovery.group)中读取GROUP:

  • 假如GROUP为空或者为DEFAULT:传入服务名与现有逻辑一致,不拼接
  • 假如GROUP为其他,则传入服务名为group__service

关于NACOS-CLUSTER的处理

SDK:
Java SDK从实例metadata中获取internal-nacos-cluster的值,假如存在,则作为实例的CLUSTER注册
SCT:
SCT从nacos配置(spring.cloud.nacos.discovery.cluster-name)中读取集群名:

  • 假如集群名为空,则不填入
  • 假如不为空,则设置为internal-nacos-cluster的metadata的值。

我按照规则拼接完发现sdk没有将group和service拆开,nacos依旧注册到了DEFAULT_GROUP image image

image

这是符合预期的吗

这个我们先提交改下 polaris-java

@lingxiao-wu
Copy link
Contributor

sdk 在shutdownhook中清理nacos注册信息时会出现npe,这是报错的堆栈信息
image

@chuntaojun
Copy link
Contributor

sdk 在shutdownhook中清理nacos注册信息时会出现npe,这是报错的堆栈信息 image

我今天修复下,重新发一个 SNAPSHOT

@chuntaojun
Copy link
Contributor

@lingxiao-wu 新的 SNAPSHOT 以及发到 maven 仓库了,可以看看先支持下 2021 ?

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

No branches or pull requests

5 participants