学习笔记:微服务-19 Hystrix-Turbine集成监控

感情迁移 提交于 2019-12-07 00:29:50

Turbine通过eureka可以收集集群的多个Hystrix短路器的状态数据,然后通过Hystrix Dashboard 展示集群的多个短路器状态,达到集中监控微服务运行状态的作用。

上节已经设置好了Hystrix Dashboard服务。

这节介绍turbine的安装使用

1. 新建spring boot项目

pom.xml增加依赖

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-turbine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-netflix-turbine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

2. application.properties 配置

server.port: 8503
spring.application.name=MicroserviceHystrixTurbine8503
spring.cloud.discovery.enabled=true
eureka.client.serviceUrl.defaultZone=http://admin:123@centos7.linbsoft.com:8101/eureka/,http://admin:123@microservice1.linbsoft.com:8102/eureka/
turbine.aggregator.cluster-config=default
turbine.cluster-name-expression=new String("default")
turbine.app-config=MICROSERVICERIBBONHYSTRIX8803,MICROSERVICEFEIGNHYSTRIX8804

# 这个是eureka上显示的微服务名字(含hystrix需要的)

3. 启动类前加注解

@EnableTurbine

4.测试

http://centos7.linbsoft.com:8503/turbine.stream  如果有数据则成功了

5. 在hystrix dashboard上查看

hystrix dashboard页面的监控地址栏填入上面的turbine监控地址即可

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!