【问题标题】:Multiple app instances on Cloud Foundry not shown in Netflix Hystrix dashboardCloud Foundry 上的多个应用程序实例未显示在 Netflix Hystrix 仪表板中
【发布时间】:2018-01-31 18:49:10
【问题描述】:

我在 Cloud Foundry 上设置了 Netflix Eureka、Hystrix 和 Turbine,分为两个应用程序:

监控应用程序“mrc-service”包括 Eureka Server、Turbine 和 Hystrix Dashboard。此应用的 application.yml 如下所示:

---
spring:
  profiles: cloud
eureka:
  instance:
    nonSecurePort: 80
    hostname: ${vcap.application.uris[0]}
    leaseRenewalIntervalInSeconds: 10
    metadataMap:
      instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
  client:
    registerWithEureka: true
    fetchRegistry: true
    service-url:
      defaultZone: https://mrc-service.myurl/eureka/

turbine:
  aggregator:
    clusterConfig: LOG-TEST
  appConfig: log-test

名为“log-test”的 Hystrix 流生成应用程序在 Cloud Foundry 上有多个实例。该应用程序是一个 Eureka 客户端,并使用 Spring Actuator 公开一个 Hystrix 流。这里是应用程序的 application.yml:

---
spring:
  profiles: cloud
eureka:
  instance:
    nonSecurePort: 80
    hostname: ${vcap.application.uris[0]}
    metadataMap:
      instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
    secure-port-enabled: true
  client:
    healthcheck:
        enabled: true
    service-url:
      defaultZone: https://mrc-service.myurl/eureka/

log-test 应用程序的两个实例正确注册到 Eureka 服务器:

但是当我开始监控涡轮流时,Hystrix 仪表板只显示一台主机(如红色箭头所示)而不是两台:

Turbine 日志正确检索了两个实例,但随后说只有一个主机启动:

2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Fetching instances for app: log-test
2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] o.s.c.n.turbine.EurekaInstanceDiscovery : Received instance list for app: log-test, size=2
2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.763 INFO 19 --- [ Timer-0] o.s.c.n.t.CommonsInstanceDiscovery : Fetching instance list for apps: [log-test]
2017-08-23T10:12:10.764+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: 2
2017-08-23T10:12:10.765+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Found hosts that have been previously terminated: 0
2017-08-23T10:12:10.765+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 DEBUG 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Retrieved hosts from InstanceDiscovery: [StatsInstance [hostname=log-test.myurl:80, cluster: LOG-TEST, isUp: true, attrs={securePort=443, fusedHostPort=log-test.myurl:443, instanceId=log-test:97d83c44-8b9e-44c4-56b4-742cef7bada0, port=80}], StatsInstance [hostname=log-test.myurl:80, cluster: LOG-TEST, isUp: true, attrs={securePort=443, fusedHostPort=log-test.myurl:443, instanceId=log-test:3d8359e4-a5c1-4aa0-5109-5b49a77a1f6f, port=80}]]
2017-08-23T10:12:10.765+02:00 [APP/PROC/WEB/0] [OUT] 2017-08-23 08:12:10.764 INFO 19 --- [ Timer-0] c.n.t.discovery.InstanceObservable : Hosts up:1, hosts down: 0

所以我想知道 Turbine 是否真的聚合了两个实例的 Hystrix 流。 Turbine 必须联系实例,例如使用 Cloud Foundry 特定的标头参数,例如 X-CF-APP-INSTANCE。不确定这是否已经发生。

所描述的方法在 Cloud Foundry 上是否可行,还是我必须将 Turbine Stream 与 RabbitMQ 一起使用?

【问题讨论】:

  • 你有多少方法注册@HystrixCommand?
  • 和@EnableHystrixDashboard
  • 只有一种方法向@HystrixCommand 注册。 HystrixDashboard 已启用,请参见上面的屏幕截图。访问单个 Hystrix 流是可行的,但是多个 Hystrix 流的涡轮聚合是问题。
  • 您尝试查看 hystrix 仪表板的网址是什么

标签: cloud-foundry netflix-eureka spring-cloud-netflix turbine


【解决方案1】:

以聚合方式打开 Turbine,步骤与 Hystrix 相同,但您应通过 Turbine 通知集群:http://localhost:8989//turbine.stream?cluster=READ。

这将打开与 Hystrix 相同的屏幕,但如果我有更多服务,它们将以聚合方式显示。

【讨论】:

  • 这在 Cloud Foundry 上不起作用,因为多个实例共享相同的路由。
【解决方案2】:

我从 Spring Cloud Netflix 问题跟踪器获得了官方 reply:从 Cloud Foundry 上的多个应用实例聚合 Hystrix 数据需要 Turbine Stream 与代理(例如 RabbitMQ)结合使用。

【讨论】:

    猜你喜欢
    • 2020-10-01
    • 2015-10-04
    • 2013-09-14
    • 2016-09-25
    • 2021-10-26
    • 2017-10-18
    • 2015-12-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多