Spring Cloud Alibaba 初体验(四) Sentinel
一、Sentinel 下载与运行
本文使用 Sentinel 1.7.1:https://github.com/alibaba/Sentinel/releases
使用自定义端口 8089 运行 Sentinel:
java -Dserver.port=8089 -Dcsp.sentinel.dashboard.server=localhost:8089 -jar sentinel-dashboard-1.7.1.jar
二、使用
2.1 添加引用
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
2.2 标识资源
使用 @SentinelResource 注解用来标识资源是否限流、降级。@SentinelResource 还提供了其它额外的属性如 blockHandler,blockHandlerClass,fallback 用于表示限流或降级的操作,更多内容可以参考 Sentinel 注解支持文档
@SentinelResource(value = "greeting")
@Override
public String greeting() {
return "hello from port: " + port;
}
2.3 添加配置
spring:
application:
name: service1
cloud:
... ...
sentinel:
transport:
dashboard: localhost:8089
2.4 查看与操作
访问 http://localhost:8089 用户名、密码均为 sentinel,可以看到 Service1 的实时监控数据,可以添加限流(流控)的策略
Spring Cloud Alibaba 初体验(四) Sentinel的更多相关文章
- Spring Cloud Alibaba 初体验(六) Seata 及结合 MyBatis 与 MyBatis-Plus 的使用
一.下载与运行 本文使用 Seata 1.1.0:https://github.com/seata/seata/releases Windows 环境下双击 bin/seata-server.bat ...
- Spring Cloud Alibaba 初体验(一) Nacos 配置中心
一.Nacos 下载与初始化配置 本文使用1.2.0,下载地址:https://github.com/alibaba/nacos/releases Nacos 单机模式支持持久化配置到 MySQL 数 ...
- Spring Cloud Alibaba 初体验(二) Nacos 服务注册与发现 + 集成 Spring Cloud Gateway
一.服务注册 添加依赖: <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>s ...
- Spring Cloud Alibaba 初体验(三) Nacos 与 Dubbo 集成
一.新建项目 新建项目,只放置接口,用于暴露 Dubbo 服务接口 public interface GreetingService { String greeting(); } 二.provider ...
- Spring Cloud Alibaba 初体验(五) SkyWalking
一.下载与运行 本文使用 SkyWalking 7.0.0:https://www.apache.org/dyn/closer.cgi/skywalking/7.0.0/apache-skywalki ...
- Spring Cloud Alibaba(三)Sentinel之熔断降级
本项目演示如何使用 Sentinel 完成 Spring Cloud 应用的熔断降级调用. Sentinel 是阿里巴巴开源的分布式系统的流量防卫组件,Sentinel 把流量作为切入点,从流量控制, ...
- Spring Cloud Alibaba基础教程:Sentinel使用Apollo存储规则
上一篇我们介绍了如何通过Nacos的配置功能来存储限流规则.Apollo是国内用户非常多的配置中心,所以,今天我们继续说说Spring Cloud Alibaba Sentinel中如何将流控规则存储 ...
- Spring Cloud Alibaba基础教程:Sentinel使用Nacos存储规则
通过上一篇<使用Sentinel实现接口限流>的介绍,相信大家对Sentinel已经有了初步的认识.在Spring Cloud Alibaba的整合封装之下,接口限流这件事情可以非常轻易的 ...
- Spring Cloud Alibaba基础教程:Sentinel Dashboard中修改规则同步到Nacos
上一篇我们介绍了如何通过改造Sentinel Dashboard来实现修改规则之后自动同步到Apollo.下面通过这篇,详细介绍当使用Nacos作为配置中心之后,如何实现Sentinel Dashbo ...
随机推荐
- css3 @keyframe 抖动/变色动画
一.纯css实现 .shake{ //抖动的元素 width: 200px; height: 100px; margin: 50px auto; background: ...
- day87:luffy:结算页面积分&支付宝接口
目录 1.积分 2.支付 1.积分 1.关于积分的表结构 1.在user表中添加credit字段 + 设计一个积分的表结构 user/models.py class User(AbstractUser ...
- linux 中断softirq tasklet
硬中断为什么不能休眠--- 中断线程以及软中断解决了什么问题---- 软中断cb函数是否允许相应本地中断,什么时候开启中断关闭中断---- 什么是软中断上下文------- 什么是tasklet 和软 ...
- cgroup实践-资源控制
1.Cgroup安装 安装Cgroups需要libcap-devel和libcgroup两个相关的包 yum install gcc libcap-devel 2.Cgroup挂载配置 Cgroup对 ...
- Vmware Tools is currently being installed on your system
问题描述: 使用虚拟机安装Ubuntu过程中一直停留在"PLEASE WAIT! Vmware Tools is currently being installed on your syst ...
- PLSQL-解析XML
DECLARE v_xmlclob CLOB := '<?xml version="1.0" encoding="UTF-8"?> <head ...
- 二叉堆python实现
二叉堆是一种完全二叉树,我们可以使用列表来方便存储,也就是说,用列表将树的所有节点存储起来. 如下图,是小根堆方式的二叉堆,假设父节点的下标为p,则他的左孩子下标为2P+1,右孩子下标为2P+2 cl ...
- TA-Lib技术指标分析
import talib as tb from talib import * print(tb.get_functions()) print(tb.get_function_groups()) 指标大 ...
- FL Studio音乐编曲入门教程
有很多小伙伴给我们留言说使用FL Studio20一段时间后,虽然对这款音乐编曲软件的功能有了一个了解,但对它整个的编曲过程还不是太熟悉.所以今天我就给大家带来了FL Studio20这款音乐编曲软件 ...
- 【MathType教学】表示分类的大括号怎么打
大括号是一种常见的数学符号,可以用于集合.分段函数中,其实大括号还可以用来总结数学知识,比如对三角形进行分类,此时用的大括号可以称为表示分类的大括号.MathType作为专业的数学公式编辑器,可以快速 ...