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

nacos无法注册到指定的namespace #9775

Open
cjy1731896459 opened this issue Dec 30, 2022 · 6 comments
Open

nacos无法注册到指定的namespace #9775

cjy1731896459 opened this issue Dec 30, 2022 · 6 comments
Assignees
Labels
area/Spring Boot Related to Spring Boot kind/bug Category issues or prs related to bug.

Comments

@cjy1731896459
Copy link

nacos-discovery: 0.2.11
nacos-config: 0.2.11

下列是我配置文件的字段
nacos.config.server-addr=
nacos.config.username=
nacos.config.password=
nacos.config.namespace=
nacos.config.bootstrap.enable=true
nacos.config.bootstrap.log-enable=true

nacos.discovery.auto-register=true
nacos.discovery.namespace=
nacos.discovery.register.ip=
nacos.discovery.register.port=

server-addr 和 register 的地址与端口都是同一个

config与discovery 的 namespace 不是同一个

现在启动后注册到nacos,是在config.namespace中的出现注册的服务,但是我想要的是把服务注册到discovery.namespace中,
请问有办法解决吗?
谢谢!

@KomachiSion KomachiSion added the area/Spring Boot Related to Spring Boot label Jan 3, 2023
@KomachiSion
Copy link
Collaborator

配置和服务是独立的,配置了不同的namespace应该是可以的, 可以debug一下看看namespace是不是正确注入了。

@cjy1731896459
Copy link
Author

配置和服务是独立的,配置了不同的namespace应该是可以的, 可以debug一下看看namespace是不是正确注入了。

配置里当auto-register 为true时才能进行注册, 但是注册的namespace是 nacos.config.namespace里设置的, nacos.discovery.namespace 没有发生作用

@KomachiSion
Copy link
Collaborator

那就需要debug看下,构造NacosNamingService实例的时候,他的namespace是从哪里读取的。理论上配置和服务应该是两个不同的properties。

@YeJiaL
Copy link

YeJiaL commented Jan 4, 2023

可以跟下对应nacos-discovery包,看服务注册的时候是否是nacos.discovery.namespace读取

@hujun-w-2
Copy link
Collaborator

这里由于namingservice对象是通过@nacosinject注入的,属性合并的时候会冲突,下个版本修复

@hujun-w-2 hujun-w-2 added the kind/bug Category issues or prs related to bug. label Jan 5, 2023
@cjy1731896459
Copy link
Author

首先,十分感谢各位的支持与回答,那看来我这边需要改为依赖springcloud了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Spring Boot Related to Spring Boot kind/bug Category issues or prs related to bug.
Projects
None yet
Development

No branches or pull requests

4 participants