springcloud提供的熔断监测,实际上是对项目中用到feign或者ribbon远程服务调用并开启熔断机制hystrix的服务,也就是说这个服务必须满足两个条件,第一是作为一个服务消费者来消费服务的,第二是需要开启熔断机制,只有满足这两个条件的服务才可以被熔断监测平台来监测到,也就是说一般的服务提供者是无需做熔断监测的。
熔断监测,可以单独运行,因此单独开启一个项目,springcloud入门系列里面熔断监测项目叫monitor,他需要监测的服务就是这里的网关项目gateway,因为只有他才调用远程服务feign和robbin,而且开启了熔断机制。
熔断监测,可以监测单应用,也可以监测集群,这个示例只是用来监测单实例应用的。他就需要依赖spring-cloud-starter-netflix-hystrix-dashboard即可,另外,如果需要监测集群,可以加入spring-cloud-starter-netflix-turbine,项目依赖如下所示:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</