赞
踩
官方文档:quick-start
下载地址: Releases · alibaba/Sentinel · GitHub
他是一个jar包直接运行即刻: 默认端口8080
我们编写springboot项目(一般我们都是使用nacos跟sentinel配置使用)
1、 添加pom依赖
- <dependency>
- <groupId>com.alibaba.cloud</groupId>
- <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
- </dependency>
- <dependency>
- <groupId>com.alibaba.cloud</groupId>
- <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
- </dependency>
2、编写application.yml文件
- spring.application.name=cloudalibaba-sentinel
- server.port=9005
-
- spring.cloud.nacos.server-addr=localhost:8848
-
- # sentinel 地址
- spring.cloud.sentinel.transport.dashboard=localhost:8080
- # 默认8719端口,键入被占用会自动从8719 ++ ,直到找到未被占用的端口
- spring.cloud.sentinel.transport.port=8719
3、编写controller+启动类开启nacos(略)
4、我们启动nacos、sentinel客户端;
我们sentinel是冷加载的,我们需要先进行访问接口,然后再去访问localhost:8080 sentinel客户端进行查看;
例如:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。