下载地址
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控制台看到 接口请求的流量信息