Spring-cloud-netflix: Status UNKNOWN with Eureka and Config Server

Created on 18 Aug 2016  路  12Comments  路  Source: spring-cloud/spring-cloud-netflix

Hi Guys,

we encountered a strange behavior with an Spring Boot app registered to an Eureka Server with use of a Config Server. If we set eureka.client.healthcheck.enabled=true and spring.cloud.config.discovery.enabled=true the app is registered to Eureka with an Status of UNKNOWN. If you disable the healthcheck it all works as expected.
We are using Brixton.SR4 and Boot 1.4.0.RELEASE

This seems to be the same problem : http://stackoverflow.com/questions/38578705/springboot-app-registers-unknown-with-eureka-in-brixton-sr3

documentation

Most helpful comment

According to the documentation, eureka.client.healthcheck.enabled should be set in application.yml. In your example you are setting it in bootstrap.yml. When you move that property to application.yml you no longer have the UNKOWN status.

All 12 comments

what is the output of /health which is what eureka.client.healthcheck.enabled=true translates to send to eureka.

/health endpoint says UP

From a personal recent experience, an unknown status from eureka with your actuactor endpoints showing UP usually means that the your discovery client didnt't called back Eureka to register it's server port once the servlet container has booted. Is your app defined with server.port=0 ?

no, static port

Could you provide a repository of a project containing an eureka server and eureka config simulating the problem ? The Eureka Client bootstrapping is sensitive, lots of race conditions involved.

According to the documentation, eureka.client.healthcheck.enabled should be set in application.yml. In your example you are setting it in bootstrap.yml. When you move that property to application.yml you no longer have the UNKOWN status.

Thx that was the problem. Now everything works as expected.

To add more explicit note

So, the current practice is to have some configuration, such as the following configuration

# user/bootstrap.yml
spring.application.name: user

register.center: http://127.0.0.1:8761/eureka/,xxx
eureka:
  client:
    registry-fetch-interval-seconds: 20
    serviceUrl.defaultZone: ${register.center}

spring.cloud.config:
  discovery.enabled: true
  discovery.serviceId: config-server
  name: all,user
  profile: dev

management.endpoints.web.exposure.include: "*"

To write to bootstrap.yml, there are more environments (dev, test, production), so there are more files (bootstrap-test.yml, bootstrap-prod.yml),

and then some configuration must be written in config-server, it is divided into different environments, so there is a corresponding user-dev.yml user-test.yml user-prod.yml configuration, which is used to save like this

# config-server/user-dev.yml
spring:
  datasource:
    url: jdbc:mysql://ip:port/db
    username: root
    password: root
    hikari:
      minimumIdle: xx
      maximumPoolSize: xx
  redis:
    host: 127.0.0.1
    port: 6379

this config can be load with lcation or git svn etc...

Finally, I have to create application.yml applocation-test.yml, application-prod.yml in each project to save the following configuration.

# user/application.yml
eureka:
  client.healthcheck.enabled: true
  instance:
    prefer-ip-address: true
    lease-renewal-interval-in-seconds: 20
    lease-expiration-duration-in-seconds: 60

1 server have 9 configuration, Are you sure this is not funny???

I am not even sure what the problem is. Please open a separate issue which clearly states what the problem is.

So, the current practice is to have some configuration, such as the following configuration

# user/bootstrap.yml
spring.application.name: user

register.center: http://127.0.0.1:8761/eureka/,xxx
eureka:
  client:
    registry-fetch-interval-seconds: 20
    serviceUrl.defaultZone: ${register.center}

spring.cloud.config:
  discovery.enabled: true
  discovery.serviceId: config-server
  name: all,user
  profile: dev

management.endpoints.web.exposure.include: "*"

To write to bootstrap.yml, there are more environments (dev, test, production), so there are more files (bootstrap-test.yml, bootstrap-prod.yml),

and then some configuration must be written in config-server, it is divided into different environments, so there is a corresponding user-dev.yml user-test.yml user-prod.yml configuration, which is used to save like this

# config-server/user-dev.yml
spring:
  datasource:
    url: jdbc:mysql://ip:port/db
    username: root
    password: root
    hikari:
      minimumIdle: xx
      maximumPoolSize: xx
  redis:
    host: 127.0.0.1
    port: 6379

this config can be load with lcation or git svn etc...

Finally, I have to create application.yml applocation-test.yml, application-prod.yml in each project to save the following configuration.

# user/application.yml
eureka:
  client.healthcheck.enabled: true
  instance:
    prefer-ip-address: true
    lease-renewal-interval-in-seconds: 20
    lease-expiration-duration-in-seconds: 60

1 server have 9 configuration, Are you sure this is not funny???

And then you have the configuration service, so, there is much more source of truth :).

Was this page helpful?
0 / 5 - 0 ratings