Nacos学习笔记-Sentinel整合示例

Sentinel文档地址:

GitHub - alibaba/Sentinel: A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)

介绍 · alibaba/Sentinel Wiki · GitHub

Sentinel下载地址:

https://github.com/alibaba/Sentinel/releases

SentinelDashboard

当前版本 sentinel-dashboard-1.8.1.jar,启动执行以下命令

java -jar -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -Dsentinel.dashboard.auth.username=sentinel  -Dsentinel.dashboard.auth.password=sentinel sentinel-dashboard-1.8.1.jar

浏览器访问http://localhost:8080/即可进入Sentinel控制台界面

整合示例

Nacos依赖版本:2.2.5.RELEASE

Sentinel依赖版本:2.2.5.RELEASE



    com.alibaba.cloud
    spring-cloud-starter-alibaba-nacos-config



    com.alibaba.cloud
    spring-cloud-starter-alibaba-nacos-discovery




    com.alibaba.cloud
    spring-cloud-starter-alibaba-sentinel



    com.alibaba.csp
    sentinel-datasource-nacos

相关配置如下:

spring.cloud.nacos.discovery.register-enabled=true
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
spring.cloud.nacos.discovery.namespace=public
spring.cloud.nacos.discovery.weight=1

spring.cloud.nacos.config.server-addr=127.0.0.1:8848
spring.cloud.nacos.config.encode=utf-8
spring.cloud.nacos.config.group=DEFAULT_GROUP 
spring.cloud.nacos.config.file-extension=properties

spring.cloud.nacos.discovery.register-enabled=true
spring.cloud.nacos.discovery.namespace=public
spring.cloud.nacos.discovery.weight=1

## Sentinel配置
# HttpServer地址
spring.cloud.sentinel.transport.port=8719
# SentinelDashBoard地址
spring.cloud.sentinel.transport.dashboard=localhost:8080

# sentinel datasource nacos

你可能感兴趣的:(J2EE,sentinel,nacos,spring,cloud,dashboard)