【发布时间】:2021-08-18 23:44:30
【问题描述】:
我正在尝试从功能区迁移到客户端负载均衡器并具有以下配置:
id 'org.springframework.boot' version '2.4.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
'springCloudVersion', "2020.0.2"
application.properties (library-service)
user-service.ribbon.listOfServers=http://localhost:9091
UserServiceProxy.java
@FeignClient(name="user-service")
@LoadBalancerClient(name="user-service")
interface UserServiceProxy{}
ApplicationClass.java
@EnableFeignClients(basePackages = "com.library.service")
public class LibraryServiceApplication {}
我不明白为什么在尝试使用代理访问用户服务时出现以下错误。 谁能帮帮我?
There was an unexpected error (type=Internal Server Error, status=500). [503] during [GET] to [http://user-service/users/10] [UserServiceProxy#getUserById(Long)]: [Load balancer does not contain an instance for the service user-service]
Ask1) 我们不能在没有 Eureka 服务器的情况下使用 Client LoadBalancer 吗?正如我们在早期版本中使用的 Ribbon 和 feign。
感谢任何帮助!
【问题讨论】:
-
负载均衡器无法识别功能区属性
标签: spring spring-boot spring-cloud spring-cloud-feign