dashboard
使用非常简单;属于客户端的。每个服务必须要有监控信息的依赖:actuator
1.导入依赖:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
<version>1.4.7.RELEASE</version>
</dependency>
2.定义端口:
3.一个启动类,加注解启动
4.启动访问:http://localhost:xxx/Hystrix ,就会有一个图标界面
5.在服务端启动类导入hystrix依赖,并在启动类中增加一个Servlet(固定代码)
@Bean
public ServletregistrationBean hystrixMetricsStreamServlet(){
ServletregistrationBean registrationBean = new ServletregistrationBean(new HystrixMetricsStreamServlet());
registrationBean.addUrlMappings("/actuator/hystrix.stream"); // 这段字符在访问页面有
return registrationBean;
}
6.在监控页面,输入http://localhost:8001//actuator/hystrix.stream, 就可以对这个服务进行监控