当前位置:   article > 正文

springcloud-alibaba sentinel 简单入门一_阿里巴巴 sentinel springboot教程

阿里巴巴 sentinel springboot教程

官方文档:quick-start

下载地址: Releases · alibaba/Sentinel · GitHub 

他是一个jar包直接运行即刻: 默认端口8080

我们编写springboot项目(一般我们都是使用nacos跟sentinel配置使用)

1、 添加pom依赖

  1. <dependency>
  2. <groupId>com.alibaba.cloud</groupId>
  3. <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>com.alibaba.cloud</groupId>
  7. <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
  8. </dependency>

2、编写application.yml文件

  1. spring.application.name=cloudalibaba-sentinel
  2. server.port=9005
  3. spring.cloud.nacos.server-addr=localhost:8848
  4. # sentinel 地址
  5. spring.cloud.sentinel.transport.dashboard=localhost:8080
  6. # 默认8719端口,键入被占用会自动从8719 ++ ,直到找到未被占用的端口
  7. spring.cloud.sentinel.transport.port=8719

3、编写controller+启动类开启nacos(略)

4、我们启动nacos、sentinel客户端;

我们sentinel是冷加载的,我们需要先进行访问接口,然后再去访问localhost:8080 sentinel客户端进行查看;

例如:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/739412
推荐阅读
相关标签
  

闽ICP备14008679号