【sentinel】docker sentinel 安装

  • Post author:
  • Post category:其他


环境安装

sentinel需要一个中间件服务:sentinel-dashboard

docker run –name sentinel -d -p 8858:8858 -p 8719:8719 -d bladex/sentinel-dashboard

运行地址:


http://localhost:8858/#/login



用户名:sentinel

密码:sentinel

规则持久化

sentinel推模式源码中的数据源是可扩展的,源码中已经实现的数据源:redis、Apollo、Nacos、Zookeeper等;

下面主要讲一下nacos这种方式

1、在业务服务里面引入 jar

<!-- Sentinel 针对 Nacos 作了适配,底层可以采用 Nacos 作为规则配置数据源 -->
		<dependency>
            <groupId>com.alibaba.csp</groupId>
            <artifactId>sentinel-datasource-nacos</artifactId>
        </dependency>

2、添加配置文件

spring:
  application:
    name: eagle-sentinel-ap
  cloud:
    sentinel:
      transport:
        dashboard: 127.0.0.1:8858
        port: 8720
      #取消控制台懒加载
      eager: true
      datasource:
        flow:
          nacos:
            server-addr: ip:port
            data-id: ${spring.application.name}-sentinel-rule
            group-id: sentinel_rules_dev
            data-type: json
            rule-type: flow

3、在nacos里面的配置eagle-check-rule

[
    {
        "resource":"/sentinel/check",
        "limitApp":"default",
        "grade":1,
        "count":1,
        "strategy":0,
        "controlBehavior":0,
        "clusterMode":false
    }
]

持久化规则

熔断降级规则

系统保护规则 (SystemRule)



版权声明:本文为yilishuku原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。