1

我在 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 服务器上正确注册:

Eureka客户端注册成功

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

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 一起使用?

4

2 回答 2

1

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

于 2017-09-04T07:41:09.393 回答
0

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

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

于 2017-09-02T08:26:56.767 回答