当前位置:  开发笔记 > 编程语言 > 正文

Spring Cloud - Registry Service端口定制

如何解决《SpringCloud-RegistryService端口定制》经验,为你挑选了1个好方法。

我想用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

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



1> Thomas Escol..:

好的,得到它... service-url属性之后的标签(可以在YML中别名为serviceUrl)是HashMap KEY,而不是属性标签.所以它必须以任何方式保存为Camel Case标签!

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

推荐阅读
360691894_8a5c48
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有