SpringCloud使用Sentinel 代替 Hystrix
本文基於springboot-2.0.6RELEASE+cloud-F.SR2
Feign環境下:只需兩步
1.在原使用hystrix的模組中新增如下依賴:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel</artifactId>
<version>0.2.1.RELEASE</version>
</dependency>
2.在application.yml 中新增feign.sentinel.enabled=true 即可為Feign啟用Sentinel支援:
# 去掉
# feign.hystrix.enabled: true
# 改為如下即可
feign.sentinel.enabled: true
Ribbon環境下:
1.先去除Spring Cloud Netflix Hystrix( spring-cloud-starter-netflix-hystrix )的依賴,再新增sentinel依賴
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-alibaba-sentinel</artifactId>
<version>0.2.1.RELEASE</version>
</dependency>
2.再在構造RestTemplate的時候加上@SentinelRestTemplate註解即可
@Bean
@SentinelRestTemplate
public RestTemplate restTemplate() {
return new RestTemplate();
}
---------------------
作者:Mr_lyh
來源:CSDN
原文:https://blog.csdn.net/Mr_lyh/article/details/86700810
版權宣告:本文為博主原創文章,轉載請附上博文連結!
相關文章
- SpringCloud使用Sentinel,Sentinel持久化,Sentinel使用nacos持久化SpringGCCloud持久化
- springcloud~SentinelSpringGCCloud
- SpringCloud之HystrixSpringGCCloud
- SpringCloud——Sentinel入門SpringGCCloud
- SpringCloud-Alibaba-SentinelSpringGCCloud
- springcloud之Hystrix熔斷器SpringGCCloud
- SpringCloud(三)Hystrix斷路器SpringGCCloud
- springcloud(四):熔斷器HystrixSpringGCCloud
- 【SpringCloud】(十二):Fegion的Hystrix支援SpringGCCloud
- (24)SpringCloud-Hystrix(熔斷器)介紹及使用SpringGCCloud
- SpringCloud11 -- Alibaba SentinelSpringGCCloud
- SpringCloud+Hystrix服務容錯SpringGCCloud
- SpringCloud學習筆記(3)——HystrixSpringGCCloud筆記
- SpringCloud-Alibaba-Sentinel(1)初探SpringGCCloud
- springcloud alibaba sentinel降級 @SentinelResourceSpringGCCloud
- springcloud(五):熔斷監控Hystrix DashboardSpringGCCloud
- SpringCloud-Hystrix 服務降級、熔斷SpringGCCloud
- 《SpringCloud專題17》-Hystrix熔斷器案例SpringGCCloud
- springcloud之hystrix原理和實踐總結SpringGCCloud
- 【SpringCloud】(十四):Feign對Hystrix的支援 fallbackFactorySpringGCCloud
- Sentinel分散式限流元件,SpringCloud Alibaba整合分散式元件SpringGCCloud
- springcloud學習筆記(四)Spring Cloud HystrixSpringGCCloud筆記
- SpringCloud之斷路器聚合監控(Hystrix Turbine)SpringGCCloud
- SpringCloud原始碼學習之Hystrix熔斷器SpringGCCloud原始碼
- springCloud入門學習--Hystrix狀態監控SpringGCCloud
- SpringCloud 2020.0.4 系列之Hystrix看板SpringGCCloud
- SpringCloud學習筆記:熔斷器Hystrix(5)SpringGCCloud筆記
- springcloud(五):熔斷監控Hystrix Dashboard和TurbineSpringGCCloud
- SpringCloud之Sentinel高可用流量框架簡單搭建SpringGCCloud框架
- springcloud 微服務配置監控端點 hystrix.streamSpringGCCloud微服務
- 跟我學SpringCloud | 第四篇:熔斷器HystrixSpringGCCloud
- SpringCloud Alibaba實戰(9:Hystrix容錯保護)SpringGCCloud
- SpringCloud微服務(基於Eureka+Feign+Hystrix+Zuul)SpringGCCloud微服務Zuul
- 微服務實戰(八)整合Sentinel閘道器服務限流功能 SpringCloud GateWay + Sentinel + Nacos微服務SpringGCCloudGateway
- SpringCloud Alibaba系列(三) Sentinel熱點引數限流SpringGCCloud
- 微服務SpringCloud之熔斷監控Hystrix Dashboard和Turbine微服務SpringGCCloud
- SpringCloud構建微服務架構-Hystrix服務降級SpringGCCloud微服務架構
- springcloud之hystrix熔斷器-Finchley.SR2版SpringGCCloud