Load balancer does not have available server for client问题,是因为消费端没有调用成功服务端。下面四步是必备的,可以检查一番。
1.写nacos发现的启动类注解。
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class MeetingConsumerApplication {
}
2.在两端yml文件中配置nacos地址。
server:
port: 8002
spring:
application:
name: meeting-consumer
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
3.写openfeign的接口。文章来源:https://www.toymoban.com/news/detail-669598.html
@Service
@FeignClient(value = "meeting-producer")
public interface FeignService {
@RequestMapping("/findInfo")
public Personinfo findInfo();
}
4.开启服务端的endpoint。文章来源地址https://www.toymoban.com/news/detail-669598.html
management:
endpoint:
web:
exposure:
include:'*'
到了这里,关于Load balancer does not have available server for client问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!