美文网首页
整合sentinel

整合sentinel

作者: wbpailxt | 来源:发表于2020-04-22 13:21 被阅读0次

一、下载sentinel 控制台jar包

https://github.com/alibaba/sentinel/releases
注:生产环境中,sentinel 控制台保本尽量保持和应用的sentinel版本一致

查看应用sentinel版本.png

二、启动sentinel 控制台

java -jar sentinel-dashboard-1.6.2

localhost:8080 打开sentinel控制台

三、为内容中心整合控制台

添加jar包

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
            <version>0.9.0.RELEASE</version>
        </dependency>

添加配置

sentinel:
      transport:
        #指定sentinel控制台的地址
        dashboard: localhost:8080

启动content-center、user-center服务
由于sentinel是懒加载,需要先访问资源才会对资源进行监控

没访问过任何资源.png
访问资源http://localhost:8010/shares/1
图片.png

四、怎么确定应用整合了sentinel呢?

应用整合了sentinel之后会暴露出来一个/actuator/sentinel的端点
所以需要为应用整合actuator

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

actuator暴露/sentinel/actuator端点默认是隐藏的,需要添加配置

management:
  endpoints:
    web:
      exposure:
        include: '*'
出现这个页面说明整合sentinel成功.png

相关文章

网友评论

      本文标题:整合sentinel

      本文链接:https://www.haomeiwen.com/subject/qkxmmctx.html