Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Cloud - Registry Service port customization

I'd like to customize the Eureka port with Spring Cloud. With the default port below, the services registry sees itself right (within the provided 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/

But if I just change server.port to 8787, no service can register itself, not even the services registry itself.

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

Can someone explain this issue and save my day? Thanks!

like image 783
Thomas Escolan Avatar asked Jan 09 '17 15:01

Thomas Escolan


1 Answers

Ok, got it... the label after service-url property (which can be aliased as serviceUrl in YML) is a HashMap KEY, not a property label. So it has to be kept as a Camel Case tag in any ways!

eureka.client.service-url.defaultZone=http://[myIP@]:8787/eureka
like image 179
Thomas Escolan Avatar answered Oct 21 '22 18:10

Thomas Escolan