我尝试使用Netflix Turbine(1.1.5)对hystrix(1.1.5)流进行分组。
Turbine App配置:
spring.application.name=moritoring_server
server.port=8989
eureka.client.serviceUrl.defaultZone = http://localhost:8761/eureka eureka.instance.preferIpAddress =真
turbine.aggregator.clusterConfig = MPI_Services turbine.appconfig = MPI_Services
健康检查使用hystrix且需要在Turbine Dashboard中显示的App:
spring.application.name=health_checks_service
spring.cloud.config.enabled=true
spring.cloud.config.discovery.enabled=true
spring.cloud.config.discovery.serviceId=MPI_Services
server.port=8081
eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka
eureka.instance.preferIpAddress=true
eureka.instance.metadataMap.cluster=MPI_Services
我可以看到来自Eureka的集群如下,来自Turbine的单个Hystrix流很好,
但是,我不能在Turbine流中使用集群,它似乎一直在加载,
有人可以告诉我如何解决这个问题吗?
谢谢, 肖恩
答案 0 :(得分:1)
这里有几点要检查。
1)您正在监视的应用程序是在端口8081上提供hystrix.stream。尝试在应用程序中将eureka.instance.metadataMap.management.port设置为8081,以便Turbine能够找出正确的端口。检查this one是否有详细信息。
2)我会尝试避免在群集名称中混合使用大写和小写字母
3)当检查Hystrix仪表板以显示涡轮流时,请确保调用演示应用程序以生成一些统计信息。仪表板保持空(加载),直到第一条消息通过Hystrix命令
4)等到Turbine应用程序实际发现应用程序集群(检查Turbine应用程序日志中的“Found hosts”和“Hosts up”消息)。这发生在某个超时间隔之后,而不是在应用程序启动后立即发生
这是一个适用于Spring Cloud Dalston.SR1的配置
演示application.yml:
management:
security:
enabled: false
port: 8081
hystrix:
enabled: true
演示bootstrap.yml:
spring:
application:
name: demo-service
cloud:
config:
discovery:
enabled: true
serviceId: config-service
eureka:
client:
register-with-eureka: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
hostname: ${APPLICATION_DOMAIN:localhost}
nonSecurePort: 8090
metadataMap:
management.port: 8082
Hystrix Dashboard& Turbine bootstrap.yml
spring:
application:
name: hystrix-service
cloud:
config:
discovery:
enabled: true
serviceId: config-service
eureka:
client:
register-with-eureka: false
serviceUrl:
defaultZone: http://localhost:8761/eureka/
Hystrix Dashboard& Turbine application.yml
...
turbine:
aggregator:
clusterConfig: DEMO-SERVICE
appConfig: demo-service
启动所有解决方案后,可以在
处找到Hystrix仪表板http://localhost:8989/hystrix
然后使用的Turbine流URL
http://localhost:8989/turbine.stream?cluster=DEMO-SERVICE
仪表板的完整Hystrix仪表板和Turbine URL:
http://localhost:8989/hystrix/monitor?stream=http%3A%2F%2Flocalhost%3A8989%2Fturbine.stream%3Fcluster%3DDEMO-SERVICE