标签:分组 csp packages 引入 自增 sentinel tar data namespace
1.主要依赖
1 <!-- nacos作为注册中心客户端所需要的依赖--> 2 <dependency> 3 <groupId>com.alibaba.cloud</groupId> 4 <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> 5 </dependency> 6 <!-- nacos作为*配置中心客户端所需要的依赖--> 7 <dependency> 8 <groupId>com.alibaba.cloud</groupId> 9 <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId> 10 </dependency> 11 <!--sentinel 核心环境 依赖--> 12 <dependency> 13 <groupId>com.alibaba.cloud</groupId> 14 <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId> 15 </dependency> 16 <!-- Sentinel支持采用 Nacos 作为规则配置数据源,引入该适配依赖 --> 17 <dependency> 18 <groupId>com.alibaba.csp</groupId> 19 <artifactId>sentinel-datasource-nacos</artifactId> 20 </dependency> 21 <!--spring cloud+dubbo 依赖--> 22 <dependency> 23 <groupId>com.alibaba.cloud</groupId> 24 <artifactId>spring-cloud-starter-dubbo</artifactId> 25 </dependency> 26 <!-- sentinel与dubbo适配需要的依赖--> 27 <dependency> 28 <groupId>com.alibaba.csp</groupId> 29 <artifactId>sentinel-apache-dubbo-adapter</artifactId> 30 </dependency>
2.主要配置
1 server: 2 port: 8080 3 spring: 4 application: 5 name: lagou-service-user 6 main: 7 allow-bean-definition-overriding: true 8 cloud: 9 nacos: 10 discovery: 11 namespace: 6813423e-78d6-4570-b654-5fa2b9d6518c 12 ################ 配置nacos server地址 13 server-addr: 127.0.0.1:8848 14 config: 15 server-addr: 127.0.0.1:8848 16 # 锁定server端的配置?件(读取它的配置项) 17 namespace: 6813423e-78d6-4570-b654-5fa2b9d6518c # 命名空间id 18 group: DEFAULT_GROUP # 默认分组就是DEFAULT_GROUP,如果使?默认分组可以不配置 19 file-extension: yaml #默认properties 20 prefix: common 21 dubbo: 22 registry: 23 # 挂载到 Spring Cloud 注册中心 24 address: spring-cloud://localhost 25 cloud: 26 # 订阅服务提供方的应用列表,订阅多个服务提供者使用 "," 连接 27 subscribed-services: lagou-service-code,lagou-service-email 28 reference: 29 check: false 30 scan: 31 # dubbo 服务扫描基准包 32 base-packages: com.lagou.edu.email 33 protocol: 34 # dubbo 协议 35 name: dubbo 36 # dubbo 协议端口( -1 表示自增端口,从 20880 开始) 37 port: -1
springcloud+nacos+sentinel+dubbo搭建项目的一些关键配置和依赖
标签:分组 csp packages 引入 自增 sentinel tar data namespace
原文地址:https://www.cnblogs.com/fallmwu/p/13858885.html