您的位置:首页 > 运维架构

Hystrix 监控可视化

2019-03-23 22:16 232 查看

返回目录

https://www.geek-share.com/detail/2764247365.html

源码位置:

微服务注册管理:

https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/microservice-discovery-eureka

生产者:

https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/microservice-provider-user

Hystrix Dashboard项目:

https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/hystrix-dashboard

Turbine项目:

https://github.com/zhaowei-zhang/CloudTest/tree/master/使用Hystrix实现容错/hystrix-turbine

使用Hystrix Dashboard 可视化监控数据

1.新建可视化监控项目,加依赖

<!--hystrix 可视化监控 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
<version>RELEASE</version>
</dependency>

2.启动类增加注解

3.修改配置文件

4.启动调接口,开监控页


打开新项目的可视化监控地址/hystrix

5.测试


当然要中文的话直接用谷歌网页翻译就好了,哈哈

使用Turbine 监控多个微服务

1.新建Turbine项目

2.加依赖

<!--hystrix 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-turbine</artifactId>
<version>RELEASE</version>
</dependency>

<!--Eureka client 依赖-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

不要忘了cloud

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

3.修改配置文件

server:
port: 9106
spring:
application:
name: hystrixturbine
eureka:
client:
service-url:
defaultZone: http://localhost:9100/eureka/
instance:
prefer-ip-address: true  #表示将注解的IP注册到Eureka Server
turbine:
app-config: MICROSERVICE-CONSUMER-MOVIE-1,MICROSERVICE-CONSUMER-MOVIE-2
cluster-name-expression: "'default'"

4.启动生产者and消费者们

消费者们如下
MICROSERVICE-CONSUMER-MOVIE-1
MICROSERVICE-CONSUMER-MOVIE-2

5.启动Turbine项目

6.启动Hystrix Dashboard

7.测试

返回目录

https://www.geek-share.com/detail/2764247365.html

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: