Zuul的容错

一 简介
在Spring Cloud中,Zuul默认已经整合了hystrix,做一个简单的实践。
二 实战
1 启动eureka。
2 启动用户微服务。
3 启动zuul
4 启动Dashboard
5 访问 http://localhost:8040/microservice-provider-user/1,可获得正常结果
6 访问 http://localhost:8040/hystrix.stream,可获得Hystrix的监控数据。
7 访问 http://localhost:8030/hystrix,并在监控地址栏中输入 http://localhost:8040/hystrix.stream,可得到如下图表
由图可知,Zuul的Hystrix的监控粒度是微服务,而不是某个API;同时也说明,所有经过Zuul的请求,都会被Hystrix保护起来。
8 关闭项目user,再次访问 http://localhost:8040/microservice-provider-user/1,将会看到页面输出类似下面的异常:

猜你喜欢

转载自blog.csdn.net/chengqiuming/article/details/80833601