作者:钟剑华  历史版本:1  最后编辑:钟剑华  更新时间:2025-10-14 18:31

    编写版本:v3.5.6
    适用版本:所有版本

    1 /ibps-basis-gateway/pom.xml解开sentinel限流部分

            <!-- sentinel限流 -->
             <dependency>
                <groupId>com.alibaba.csp</groupId>
                <artifactId>sentinel-spring-cloud-gateway-adapter</artifactId>
            </dependency>
            <dependency>
                <groupId>com.alibaba.csp</groupId>
                <artifactId>sentinel-transport-simple-http</artifactId>
    <!--            使用sentinel-Dashboard需要注释fastjson的排除,不然通讯sentinel的通讯组件有问题-->
                <exclusions>
                    <exclusion>
                        <groupId>com.alibaba</groupId>
                        <artifactId>fastjson</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.alibaba.csp</groupId>
                <artifactId>sentinel-logging-slf4j</artifactId>
            </dependency>

    2 控制台需要另外下载sentinel-dashboard-1.8.1.jar查看,执行命令
    java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -Dproject.name=sentinel-dashboard -jar sentinel-dashboard-1.8.1.jar

    3 规则配置需要看官网https://help.aliyun.com/zh/ahas/user-guide/configure-throttling-rules?spm=a2c4g.11186623.help-menu-87450.d_2_1_0_5_0.a7691357ojjhsE

    4 网关启动时加入 JVM 参数 -Dcsp.sentinel.dashboard.server=consoleIp:port 指定控制台地址和端口。更多的参数参见
    https://sentinelguard.io/zh-cn/docs/startup-configuration.html