Dar*_*enK 2 spring spring-boot spring-cloud-netflix spring-cloud-config
我正在运行 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”。
当两个标志都启用/为真时,我会看到这一系列的日志记录:
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]
Run Code Online (Sandbox Code Playgroud)
如何让应用程序注册为 UP,同时启用/启用这两个标志?
引导程序.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
Run Code Online (Sandbox Code Playgroud)
小智 6
我知道很久以前就有人问过这个问题,但我遇到了同样的问题,这是唯一与我的问题直接匹配的问题。
我正在使用 Camden.SR2,如果您在参考文档中找到 Eureka's Health Checks 部分,您将看到以下警告:
eureka.client.healthcheck.enabled=true应该只设置在application.yml. 设置值 inbootstrap.yml会导致不良副作用,例如在 eureka 中注册UNKNOWN状态。
这正是问题所在。如果您将属性的设置转移到application.yml文件,它会按预期工作。
| 归档时间: |
|
| 查看次数: |
4107 次 |
| 最近记录: |