mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-04 01:52:21 +08:00
feat:网关整合Sentinel
This commit is contained in:
parent
278053d559
commit
3dc9621c99
@ -59,7 +59,7 @@
|
||||
<artifactId>spring-security-oauth2-jose</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 流量控制、熔断降级 -->
|
||||
<!-- Sentinel流量控制、熔断降级 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
||||
@ -68,6 +68,10 @@
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Api文档 -->
|
||||
<dependency>
|
||||
|
@ -6,9 +6,37 @@ spring:
|
||||
name: youlai-gateway
|
||||
cloud:
|
||||
nacos:
|
||||
# 注册中心
|
||||
discovery:
|
||||
server-addr: http://localhost:8848
|
||||
# 配置中心
|
||||
config:
|
||||
# docker启动nacos-server需要配置
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
sentinel:
|
||||
eager: true
|
||||
transport:
|
||||
dashboard: e.youlai.tech:8858
|
||||
datasource:
|
||||
# 网关限流
|
||||
gw-flow:
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
dataId: ${spring.application.name}-gw-flow-rules
|
||||
groupId: SENTINEL_GROUP
|
||||
data-type: json
|
||||
rule-type: gw-flow
|
||||
# 网关API自定义分组
|
||||
gw-api-group:
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
dataId: ${spring.application.name}-gw-api-group-rules
|
||||
groupId: SENTINEL_GROUP
|
||||
data-type: json
|
||||
rule-type: gw-api-group
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -9,9 +9,30 @@ spring:
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: http://c.youlai.store:8848
|
||||
server-addr: http://106.75.231.227:8848
|
||||
namespace: prod_namespace_id
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yaml
|
||||
namespace: prod_namespace_id
|
||||
sentinel:
|
||||
eager: true
|
||||
transport:
|
||||
dashboard: e.youlai.tech:8858
|
||||
datasource:
|
||||
# 网关限流
|
||||
gw-flow:
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
dataId: ${spring.application.name}-gw-flow-rules
|
||||
groupId: SENTINEL_GROUP
|
||||
data-type: json
|
||||
rule-type: gw-flow
|
||||
# 网关API自定义分组
|
||||
gw-api-group:
|
||||
nacos:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
dataId: ${spring.application.name}-gw-api-group-rules
|
||||
groupId: SENTINEL_GROUP
|
||||
data-type: json
|
||||
rule-type: gw-api-group
|
||||
|
Loading…
Reference in New Issue
Block a user