在运行eureka客户端进行注册时报错!
报错信息如下:
Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
分析一下:DefaultEndpoint{ serviceUrl=’http://localhost:8761/eureka/}这局,说的是它的默认的是8761端口,而我设置的eureka服务端端口不是这个,所以报了错,那我设置的对应的配置怎么没起作用呢?
这样一看是配置eureka注册地址出错,去看配置信息`,一般是错位或者空格问题,或者是单词打错。
# eureka
eureka:
client:
register-with-eureka: true #注册eureka
fetch-registry: true # 获取注册信息
service-url:
defaultzone: http://127.0.0.1:7000/eureka #访问地址
instance:
prefer-ip-address: true #暴露ip
instance-id: xry #名字
发现defaultzone写错,应该为defaultZone!
重新运行,问题解决!
版权声明:本文为weixin_42322925原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。