gpt4 book ai didi

spring-cloud - Spring Cloud - Registry Service 端口定制

转载 作者:行者123 更新时间:2023-12-04 13:57:27 29 4
gpt4 key购买 nike

我想用 Spring Cloud 自定义 Eureka 端口。
使用下面的默认端口,服务注册表可以正确看待自己(在提供的 GUI 中)

spring:
application:
name: services-registry
server:
port: 8761

eureka:
instance:
hostname: localhost
nonSecurePort: ${server.port}
client:
register-with-eureka: true
fetch-registry: false
service-url:
default-zone: http://${eureka.instance.hostname}:${server.port}/eureka/

但是如果我只是将 server.port 更改为 8787,则没有服务可以自行注册,甚至服务注册表本身也无法注册。
2017-01-09 16:18:21.584  WARN 17496 --- [nfoReplicator-0] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failure
2017-01-09 16:18:21.584 WARN 17496 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_SERVICES-REGISTRY/xxx.org:services-registry:8787 - registration failed Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
...
2017-01-09 16:13:33.299 WARN 17496 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : There was a problem with the instance info replicator

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

有人可以解释这个问题并挽救我的一天吗?谢谢!

最佳答案

好的,明白了... service-url 属性(在 YML 中可以别名为 serviceUrl)之后的标签是一个 HashMap key ,不是属性标签。所以它必须以任何方式保存为 Camel Case 标签!

eureka.client.service-url.defaultZone=http://[myIP@]:8787/eureka

关于spring-cloud - Spring Cloud - Registry Service 端口定制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41550959/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com