Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
loit-gateway-example
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
loit-Infrastructure-example
loit-gateway-example
Commits
b050fd7a
提交
b050fd7a
authored
8月 06, 2020
作者:
陈世营
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【修改】增加网关限流规则
上级
28fa1e4c
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
136 行增加
和
66 行删除
+136
-66
application.yml
src/main/resources/application.yml
+103
-2
bootstrap.properties
src/main/resources/bootstrap.properties
+7
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+0
-64
gateway-service-degrade-rules
src/main/resources/gateway-service-degrade-rules
+9
-0
gateway-service-sentinel-api
src/main/resources/gateway-service-sentinel-api
+10
-0
gateway-service-sentinel-gateway
src/main/resources/gateway-service-sentinel-gateway
+7
-0
没有找到文件。
src/main/resources/application.yml
浏览文件 @
b050fd7a
...
...
@@ -10,4 +10,106 @@ logging:
org.springframework.cloud.gateway
:
trace
org.springframework.http.server.reactive
:
debug
org.springframework.web.reactive
:
debug
reactor.ipc.netty
:
debug
\ No newline at end of file
reactor.ipc.netty
:
debug
spring
:
application
:
name
:
gateway-service
main
:
allow-bean-definition-overriding
:
true
cloud
:
# 使用 Naoos 作为服务注册发现
nacos.discovery
:
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
gateway
:
enabled
:
true
discovery
:
locator
:
lower-case-service-id
:
true
routes
:
# 采用自定义路由 ID(有固定用法,不同的 id 有不同的功能,详见:https://cloud.spring.io/spring-cloud-gateway/2.0.x/single/spring-cloud-gateway.html#gateway-route-filters)
# - id: ORDER-SERVICE-TTT
# # 采用 LoadBalanceClient 方式请求,以 lb:// 开头,后面的是注册在 Nacos 上的服务名
# uri: lb://order-service
# # Predicate 翻译过来是“谓词”的意思,必须,主要作用是匹配用户的请求,有很多种用法
# predicates:
# - Path=/api-order/**
# filters:
# - StripPrefix=1
# - id: STORAGE-SERVICE_TTTT
# uri: lb://storage-service
# predicates:
# - Path=/api-storage/**
# filters:
# - StripPrefix=1
-
id
:
loit-portal-id
uri
:
lb://loit-portal
predicates
:
-
Path=/api-portal/**
filters
:
-
StripPrefix=1
logoutSign
:
true
sentinel
:
# datasource.ds2.file:
# file: "classpath: gateway-service-sentinel-gateway"
# ruleType: gw-flow
# datasource.ds1.file:
# file: "classpath: gateway-service-sentinel-api"
# ruleType: gw-api-group
# enabled: true
datasource
:
ds2
:
nacos
:
data-id
:
${spring.application.name}-sentinel-gateway
group-id
:
DEFAULT_GROUP
rule-type
:
gw-flow
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
data-type
:
json
ds1
:
nacos
:
data-id
:
${spring.application.name}-sentinel-api
group-id
:
DEFAULT_GROUP
rule-type
:
gw-api-group
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
data-type
:
json
ds3
:
nacos
:
server-addr
:
47.114.50.99:8010
namespace
:
46c2400a-5773-4c26-be68-2e90a673259b
dataId
:
${spring.application.name}-degrade-rules
data-type
:
json
rule-type
:
degrade
# datasource.ds3.file:
# file: "classpath: gateway-service-degrade-rules"
# ruleType: degrade
# dataType: json
## 应用与Sentinel控制台交互的端口,应用本地会起一个该端口占用的HttpServer
transport
:
## Sentinel 控制台地址
dashboard
:
localhost:8090
## 应用与Sentinel控制台的心跳间隔时间
heartbeat-interval-ms
:
10000
port
:
8719
filter
:
enabled
:
true
scg.fallback
:
## Spring Cloud Gateway 熔断后的响应模式(选择 redirect or response)
mode
:
response
## Spring Cloud Gateway 响应模式为 'response' 模式对应的响应码
response-status
:
444
## Spring Cloud Gateway 响应模式为 'response' 模式对应的响应内容
response-body
:
系统繁忙请稍后再试
scg
:
order
:
-100
# 断路器设置
feign
:
sentinel
:
enabled
:
true
src/main/resources/bootstrap.properties
0 → 100644
浏览文件 @
b050fd7a
spring.profiles.active
=
dev
spring.application.name
=
gateway-service
# Nacos \u914D\u7F6E\u4E2D\u5FC3\u5730\u5740http://39.100.254.140/
spring.cloud.nacos.config.server-addr
=
47.114.50.99:8010
spring.cloud.nacos.config.namespace
=
46c2400a-5773-4c26-be68-2e90a673259b
spring.cloud.nacos.config.file-extension
=
yaml
\ No newline at end of file
src/main/resources/bootstrap.yml
deleted
100644 → 0
浏览文件 @
28fa1e4c
spring
:
application
:
name
:
gateway-service
main
:
allow-bean-definition-overriding
:
true
cloud
:
# 使用 Naoos 作为服务注册发现
nacos.discovery
:
server-addr
:
39.100.254.140:8103
namespace
:
3ac84119-5558-4bf8-b309-034dd0e458e0
gateway
:
enabled
:
true
discovery
:
locator
:
lower-case-service-id
:
true
routes
:
# 采用自定义路由 ID(有固定用法,不同的 id 有不同的功能,详见:https://cloud.spring.io/spring-cloud-gateway/2.0.x/single/spring-cloud-gateway.html#gateway-route-filters)
-
id
:
ORDER-SERVICE-TTT
# 采用 LoadBalanceClient 方式请求,以 lb:// 开头,后面的是注册在 Nacos 上的服务名
uri
:
lb://order-service
# Predicate 翻译过来是“谓词”的意思,必须,主要作用是匹配用户的请求,有很多种用法
predicates
:
-
Path=/api-order/**
filters
:
-
StripPrefix=1
-
id
:
STORAGE-SERVICE_TTTT
uri
:
lb://storage-service
predicates
:
-
Path=/api-storage/**
filters
:
-
StripPrefix=1
sentinel
:
datasource.ds2.nacos
:
server-addr
:
39.100.254.140:8103
namespace
:
3ac84119-5558-4bf8-b309-034dd0e458e0
data-id
:
${spring.application.name}-sentinel-gateway
data-type
:
json
group-id
:
DEFAULT_GROUP
ruleType
:
gw-flow
datasource.ds1.nacos
:
server-addr
:
39.100.254.140:8103
namespace
:
3ac84119-5558-4bf8-b309-034dd0e458e0
data-id
:
${spring.application.name}-sentinel-api
data-type
:
json
group-id
:
DEFAULT_GROUP
ruleType
:
gw-api-group
## 应用与Sentinel控制台交互的端口,应用本地会起一个该端口占用的HttpServer
transport
:
## Sentinel 控制台地址
dashboard
:
localhost:8080
## 应用与Sentinel控制台的心跳间隔时间
heartbeat-interval-ms
:
60000
filter
:
enabled
:
true
scg.fallback
:
## Spring Cloud Gateway 熔断后的响应模式(选择 redirect or response)
mode
:
response
## Spring Cloud Gateway 响应模式为 'response' 模式对应的响应码
response-status
:
444
## Spring Cloud Gateway 响应模式为 'response' 模式对应的响应内容
response-body
:
系统繁忙请稍后再试
scg
:
order
:
-100
\ No newline at end of file
src/main/resources/gateway-service-degrade-rules
0 → 100644
浏览文件 @
b050fd7a
[
{
"resource": "loit-portal-api",
"count": 50,
"grade": 0,
"timeWindow": 100
}
]
\ No newline at end of file
src/main/resources/gateway-service-sentinel-api
0 → 100644
浏览文件 @
b050fd7a
[{
"apiName": "loit-portal-api",
"predicateItems": [
{
"pattern": "/api-portal/**",
"matchStrategy": 1
}
]
}
]
src/main/resources/gateway-service-sentinel-gateway
0 → 100644
浏览文件 @
b050fd7a
[{
"resource": "loit-portal-api",
"count": 1,
"intervalSec": 1
}
]
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论