微服务-服务保护
服务保护的方案
1.1、请求限流
1.2、线程的隔离
1.3、服务的熔断
2、Sentinel
微服务保护的技术有很多,在目前国内使用较多的是Sentinel
2.1、下载地址:Releases · alibaba/Sentinel (github.com)
2.2、运行
java -Dserver.port=端口号 -Dcsp.sentinel.dashboard.server=localhost:端口号-Dproject.name=sentinel-dashboard -jar jar包名.jar
2.3、访问
localhost:端口号;账号、密码,默认都是:sentinel
2.4、微服务的整合
2.4.1、引入依赖
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
2.4.2、修改配置文件 .yml
spring:
cloud:
sentinel:
transport:
dashboard: localhost:端口号