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

NacosRule 中的 lb 被错误地绑定到另一个服务名 #3944

Open
yuanqinglong-code opened this issue Jan 24, 2025 · 1 comment
Open

Comments

@yuanqinglong-code
Copy link

springCloud gateway集成了NacosRule负载均衡策略,当网关正常运行一段时间后出现下面的问题(gateway和nacos版本为2.2.5.RELEASE)

Image
此时选择的服务是目标服务

Image
这里判断执行了super.chooseServer(key)

Image
super.chooseServer(key)中的IRule是NacosRule这里的lb变成了其他服务
NacosRule中getLoadBalancer()变成了其他服务 导致请求404

Image

请问这个是什么原因呢

@yuhuangbin
Copy link
Collaborator

不太清楚你是怎么定义NacosRule的,在网关中使用,定义为多例模式。

@Bean
@Scope(value="prototype")
public IRule loadBalanceRule(){
  return new NacosRule();
}

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

2 participants