当前位置:网站首页>Nacos调用微服务两个问题:1.Load balancer does not contain an instance for the service 2.Connection refused

Nacos调用微服务两个问题:1.Load balancer does not contain an instance for the service 2.Connection refused

2022-06-27 03:13:00 nightwind2017

项目场景:

Spring Boot + Spring Cloud + Spring Cloud Alibaba + Nacos

1、问题描述

local项目启动后,利用nacos访问注册中心里的名为test服务时,在test服务已经注册到注册中心的情况下,loca仍然访问不到test,日志显示:

Load balancer does not contain an instance for the service “test”

解决方案:

这个时候要检查local项目的配置文件,找到nacos的配置位置

在这里插入图片描述

将这里的ip配置为该项目启动所在机器的ip地址,如机器ip为本地,就配置为127.0.0.1

2、问题描述

上述问题修正之后,local访问test可能会出现如下问题:

Connection refused: connect executing POST http:

解决方案:

test 如果是部署在某个服务器上,就要检查test项目在这个服务器上所使用的端口是否开启,并且外部可以访问
检测方法是,打开windows系统的cmd命令行,输入如下指令:

telnet xxx.xx.xx.xx(test项目所在服务器的ip) 0000(test项目使用的端口号)

如果命令行无法识别telnet命令,可查询如何在windows系统开启telnet服务
如何在windows系统开启telnet服务
如果端口访问不通,则在服务器开启该端口

原网站

版权声明
本文为[nightwind2017]所创,转载请带上原文链接,感谢
https://blog.csdn.net/nightwind2017/article/details/125460612