Bläddra i källkod

feat:测试Sentinel + Nacos整合,在Nacos进行Sentienl限流规则的持久化,从Naocs中读取限流规则

yang yi 1 år sedan
förälder
incheckning
add2c55713

+ 5 - 0
member-service-consumer/pom.xml

@@ -16,6 +16,11 @@
         <maven.compiler.target>17</maven.compiler.target>
     </properties>
     <dependencies>
+        <!--导入Sentinel整合Nacos进行Sentinel规则持久化的依赖-->
+        <dependency>
+            <groupId>com.alibaba.csp</groupId>
+            <artifactId>sentinel-datasource-nacos</artifactId>
+        </dependency>
         <!--导入Sentinel依赖-->
         <dependency>
             <groupId>com.alibaba.cloud</groupId>

+ 10 - 0
member-service-consumer/src/main/resources/application.yaml

@@ -14,6 +14,16 @@ spring:
       transport:
         dashboard: localhost:8080
         port: 8719
+      datasource:
+        #配置一个数据源,规则持久化的数据源
+        ds1:
+          nacos:
+            server-addr: localhost:8848
+            dataId: Sentinel-config.json
+            groupId: SENTINEL_GROUP
+            data-type: json
+            rule-type: flow
+
 feign:
   sentinel:
     #配置OpenFein整合Sentinel