keevw
keevw

Reputation: 73

Eureka server and eureka client to separate tomcat servers

I'm looking for a way to be able to deploy the Eureka server to a different tomcat server than the Eureka client.

this is the client application.yml:

eureka:
  client:
    registryFetchIntervalSeconds: 5
  instance:
    preferIpAddress: true
    leaseRenewalIntervalInSeconds: 10

server:
  port: 8080

spring:
  application.name: my-client
  jmx:
      default-domain: my-client

and the server application.yml looks like:

server:
  port: 8761
eureka:
  client:
    registerWithEureka: false
    fetchRegistry: false

It works perfectly fine if I deploy them to the same tomcat-server. But if I start the tomcat with the server only and later start the server with the client, I get the following error:

2017-03-09 16:17:58.496  INFO 7693 --- [on(2)-127.0.0.1] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2017-03-09 16:17:58.496  INFO 7693 --- [on(2)-127.0.0.1] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2017-03-09 16:17:58.496  INFO 7693 --- [on(2)-127.0.0.1] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2017-03-09 16:18:04.740  WARN 7693 --- [on(2)-127.0.0.1] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failure with status code 404; retrying on another server if available
2017-03-09 16:18:04.745 ERROR 7693 --- [on(2)-127.0.0.1] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_MYCLIENT-CLIENT/192.168.196.141:my-client:8080 - was unable to refresh its cache! status = Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
    at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:111) ~[eureka-client-1.4.12.jar:1.4.12]
    at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) ~[eureka-client-1.4.12.jar:1.4.12]

What is the difference between bootstrap.yml and application.yml?

Any help would be appreciated!

Upvotes: 0

Views: 3679

Answers (1)

jbaddam17
jbaddam17

Reputation: 327

your client application.yml dosen't have information about where your eureka server is running.client should register with eureka server, for that you need to configure your client application.yml as follow

eureka:
 client:
  serviceUrl:
       defaultZone:http:localhost:8081/eureka/

 instance:     
  instanceId:application_name:${random.value}

Upvotes: 1

Related Questions