我正在效仿http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html用Spring Cloud构建分布式系统。
除了Eureka Client Healthcheck之外,所有的工作都像预期的一样。
我有过
eureka: client: healthcheck: enabled: true
并将我的服务指向不存在的config_server,结果是
http://myservice:8080/health {状态:“关闭”}
但Eureka服务器仍然将此实例显示为启动状态,并不断向其发送流量。
我遗漏了什么?
spring-boot: 1.2.8.Relase
spring-cloud-netflix : 1.0.4.RELEASE
发布于 2016-01-26 19:49:14
您必须显式设置eureka.client.healthcheck.enabled=true才能将Spring Boot健康指示器链接到Eureka注册。源码参考:here。
发布于 2016-01-26 20:06:35
好了,我想我找到了。
根据https://jmnarloch.wordpress.com/2015/09/02/spring-cloud-fixing-eureka-application-status/的说法,这个功能将只在Spring Cloud 1.1上可用。
要使其与1.0.4一起工作,我需要实现我自己的HealthCheckHandler。
感谢@xtreme-biker提出Spring Cloud版本问题。
https://stackoverflow.com/questions/35012941
复制相似问题