eureka报错:链接8761被拒绝
来龙去脉
在idea环境中运行没有问题
我的设置是:
server:
port: 8001
spring:
application:
name: registry-server
eureka:
instance:
hostname: localhost
client:
fetch-registry: false
register-with-eureka: false
微服务部署后,eureka服务会不绝报上面的错误
org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: 拒绝毗连
毗连http://localhost:8761/eureka 的注册中央被拒绝,无法毗连
但是我已经改了端口为8001
即时只启动eureka服务仍然报错,但是报错又不影响客户端的注册和发现
部署后的设置:
server:
port: 8001
spring:
application:
name: eureka-server
eureka:
instance:
hostname: 192.168.110.157
client:
fetch-registry: false
register-with-eureka: false
原因分析
8761 是Eureka的默认路径, Eureka以为启动设置里没有对它的url地点指定时, 会默认寻找这个地点
办理办法
用defaultZone设置注册中央地点
server:
port: 8001
spring:
application:
name: eureka-server
eureka:
instance:
hostname: 192.168.110.157
client:
fetch-registry: false
register-with-eureka: false
service-url:
defaultZone: http://localhost:8001/eureka/
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |