SpringCloudAlibaba - windows 安装 alibaba / Sentinel

alibaba/Sentinel 的安装和使用

下载地址

Sentinel下载地址
在这里插入图片描述
启动命令

java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard.jar

注意:项目启动需要在jdk1.8版本之后
其中:

-Dserver.port=8080 用于指定 Sentinel 控制台端口为 8080

访问地址

http://localhost:8080
用户名和密码都是 sentinel
访问页面如下效果图
在这里插入图片描述

客户端如何接入

  • 引入JAR包
       <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
            <version>2.1.1.RELEASE</version>
        </dependency>
  • application.yml中添加 sentinel 控制台的信息
spring:
  cloud:
    sentinel:
      transport:
        dashboard: localhost:8080
  • 写一个controller
@RestController
public class DemoController {

    @GetMapping("/hello")
    public String hello() {
        return "hello sentinel";
    }
}

启动项目
访问hello接口,就可以在sentinel控制台看到 接口请求的流量信息
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值