springcloud-Sentinel初步配置

SpringCloud-Sentine(熔断和监控)

Sentinel 是阿里巴巴开源的一款断路器实现

Sentinel与Hystrix的区别

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-xUg07Ot3-1610983070970)(img/sentinel-hystrix区别.png)]

一、配置管理控制台

  1. 下载sentinel-dashboard.jar

点这个连接直接下载1.3.0版:https://github.com/alibaba/Sentinel/releases/download/1.3.0/sentinel-dashboard-1.3.0-en.jar

或者进入https://github.com/alibaba/Sentinel/wiki/Dashboard 页面的标题2.1Download the dashboard

(sentinel中文文档地址:https://github.com/alibaba/Sentinel/wiki/%E4%BB%8B%E7%BB%8D

(sentinel-dashboard.jar官方使用:https://github.com/alibaba/Sentinel/wiki/Dashboard

  1. cmd中运行命令(sentinel的jar所在目录)
java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -
Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar
  1. 打开浏览器输入 http://localhost:8080

默认用户,密码都是sentinel,(参考https://github.com/alibaba/Sentinel/wiki/%E6%8E%A7%E5%88%B6%E5%8F%B0#%E9%89%B4%E6%9D%83 对用户密码配置)

默认情况下Sentinel 会在客户端首次调用的时候进行初始化,开始向控制台发送心跳包。也可以配置sentinel.eager=true ,取消Sentinel控制台懒加载(懒加载:只有访问该微服务才会在sentinel控制台监控到)。

二、项目配置

  1. 引入jar包依赖

非springcloud程序需要引入:

<dependency>
    <groupId>com.alibaba.csp</groupId>
    <artifactId>sentinel-transport-simple-http</artifactId>
</dependency>

springclou程序引入:

  • 父工程
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-dependencies               </artifactId>
    #注意这个版本,要和springcloud相关
    <version>2.1.0.RELEASE</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>

ps: spring-cloud-alibaba和spring-cloud有版本问题,需要配置对应的版本(https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E
在这里插入图片描述

  • 子工程

                
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值