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

同一台机器多个服务获取不同 namespace 下的配置会错乱 #12085

Closed
wanghaida opened this issue May 11, 2024 · 2 comments
Closed

Comments

@wanghaida
Copy link

wanghaida commented May 11, 2024

环境:

  • nacos 2.3.2

假设同一台机器:

  • 有 aaa 服务,连接 nacos,获取 namespace 为 prodbase 配置,配置内容为 aaa123
  • 有 bbb 服务,连接 nacos,获取 namespace 为 testbase 配置,配置内容为 bbb456

有如下结果:

  1. 如果先启动 aaa 服务,那么获取到的配置为 aaa123,再启动 bbb 服务,获取到的配置也为 aaa123
  2. 停止 aaa 服务,bbb 服务的 subscribe 收到变化,内容为 bbb456
  3. 再启动 aaa 服务,获取到的配置为 bbb456

颠倒 aaa 和 bbb 的启动顺序同理。测试了二进制启动方式和 Docker 启动方式,均有如上的问题。

@KomachiSion
Copy link
Collaborator

我自己拿nacos-client测试,不存在这样的问题, 请首先排查应用启动的配置文件、环境变量和jvm参数等,确认同一个机器的两个服务没有共享同一个本地配置导致读取的命名空间错误。

同时可以从nacos-client的log中看到底获取配置时获取了哪个命名空间。

再次也可以使用nacos-example模块中的样例,使用纯粹的nacos-client测试,以此来确定是您应用本身存在读取命名空间配置的问题。

@wanghaida
Copy link
Author

node 包 nacos 的问题,获取的是缓存,我提错仓库了。

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

No branches or pull requests

2 participants