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>
|
<artifactId>spring-security-oauth2-jose</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 流量控制、熔断降级 -->
|
<!-- Sentinel流量控制、熔断降级 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
||||||
@ -68,6 +68,10 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.csp</groupId>
|
||||||
|
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Api文档 -->
|
<!-- Api文档 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -3,12 +3,40 @@ server:
|
|||||||
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
application:
|
||||||
name: youlai-gateway
|
name: youlai-gateway
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
|
# 注册中心
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: http://localhost:8848
|
server-addr: http://localhost:8848
|
||||||
|
# 配置中心
|
||||||
config:
|
config:
|
||||||
# docker启动nacos-server需要配置
|
|
||||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||||
file-extension: yaml
|
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:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: http://c.youlai.store:8848
|
server-addr: http://106.75.231.227:8848
|
||||||
namespace: prod_namespace_id
|
namespace: prod_namespace_id
|
||||||
config:
|
config:
|
||||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
namespace: prod_namespace_id
|
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