1.依赖配置
hystrix-dashboard模块需要的配置信息
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
<version>2.2.10.RELEASE</version>
</dependency>
被监控模块
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>2.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
<version>2.2.10.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2.注解问题
1. 监控模块
@EnableHystrixDashboard
public class HystrixDashBoardApplication {
public static void main(String[] args) {
SpringApplication.run(HystrixDashBoardApplication.class, args);
}
}
2.被监控模块
@EnableHystrix
public class BorrowApplication {
public static void main(String[] args) {
SpringApplication.run(BorrowApplication.class,args);
}
}
3.监控对象问题
只对 带上@HystrixCommand注解的方法进行监控。没有则一直loading
4.配置问题
被监控模块
暴露端口
management:
endpoints:
web:
exposure:
include: '*'
监控模块
server:
port: 8900
hystrix:
dashboard:
proxy-stream-allow-list: "localhost"
# 将localhost添加到白名单
5.端口号
是被监控模块的端口号