我正在运行Spring Cloud Brixton SR3 - Spring Netflix Eureka,Spring Cloud Config和Discovery Client应用程序 . 配置客户端应用程序时
eureka.client.healthcheck.enabled=true 和 spring.cloud.config.discovery.enabled=true
该应用程序启动在Eureka注册,状态为“UNKNOWN”,永远不会更改为“UP” . 如果其中任何一个标志设置为false,则应用程序启动时注册为“UP” .
当两个标志都启用/为true时,我看到这一系列的日志记录:
2016-07-13 17:41:38.144 INFO 13180 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1468456898144, current=UP, previous=STARTING]
2016-07-13 17:41:38.144 DEBUG 13180 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : Executing on-demand update of local InstanceInfo
2016-07-13 17:41:38.144 DEBUG 13180 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator : Canceling the latest scheduled update, it will be rescheduled at the end of on demand update
2016-07-13 17:41:38.145 INFO 13180 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1468456898145, current=UNKNOWN, previous=UP]
如何使用这两个标志启用/ true来使应用程序注册为UP?
bootstrap.yml
spring:
application:
name: hello-brixton
# Spring Cloud Config
cloud:
config:
name: hello-brixton
discovery:
enabled: true
serviceId: config-service
eureka:
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: ${SERVICE_REGISTRY_URL:http://localhost:8080/eureka/}
healthcheck:
enabled: true
1 回答
我知道这是很久以前的问题,但我遇到了同样的问题,这是唯一与我的问题直接相符的问题 .
我使用的是Camden.SR2,如果您在参考文档中找到Eureka的 Health 检查部分,您将看到以下警告:
这正是问题所在 . 如果将属性的设置转移到
application.yml
文件,它将按预期工作 .