Skip to content

Commit 8b965cb

Browse files
authored
Merge pull request #47 from SpringCloud/A
A
2 parents 11647a8 + 950a013 commit 8b965cb

File tree

7 files changed

+441
-3
lines changed

7 files changed

+441
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ insert into `user` ( `user_id`, `account`, `name`, `password`, `roles`, `status`
2727
这是添加管理员账号的,用户名:`admin` 密码:`abc123`
2828

2929
## 使用手册
30+
[管控端部署手册](doc/guide/guide-gray-server-deploy.md)
31+
[客户端部署手册](doc/guide/guide-gray-client-deploy.md)
32+
[管控端配置参数说明](doc/guide/gray-server-properties.md)
33+
[客户端配置参数说明](doc/guide/gray-client-properties.md)
3034
[管控端界面使用手册](doc/guide/gray-admin-guide.md)
3135

3236
## 版本信息
@@ -46,7 +50,7 @@ C | Greenwich | 2.1.*
4650
2. 灰度放量
4751

4852
通过金丝雀测试后,可以逐渐放量到新的版本上。例如,根据userId或者ip放5%的流量到其中一台灰度实例上,观察一段时间没异常,可调整放入20%的流量,如果一台实例扛不住,可再发一台或多台实例。将发布产生的风险保持在可控范围内。
49-
![](doc/img/gray-Inflow-rate.png)
53+
![](doc/img/gray-Inflow-rate.png)
5054

5155
3. 切断实例流量
5256

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
2+
# SpringCloudGray 配置参数
3+
4+
### 客户端
5+
#### gray
6+
Property Name | Default Value | Remarks
7+
--- | --- | ---
8+
enabled | false | 是否启用实例记录清除任务(默认为false)
9+
grayRouting | true | 是否灰度路由,如果开启,将优先对灰度实例进行路由,如果没有匹配的灰度实例,再对正常实现进行路由
10+
11+
examp
12+
``` yaml
13+
gray:
14+
enabled: true
15+
grayRouting: true
16+
```
17+
18+
#### gray.server
19+
灰度管控端相关的配置
20+
21+
Property Name | Default Value | Remarks
22+
--- | --- | ---
23+
url | | 灰度管控端的url <br/>可以http://192.168.0.1:8080/uri <br/>也可以是ribbon的风格 http://gray-server/uri
24+
loadbalanced | false | url是否是负载均衡的路径
25+
retryable | true | 在和灰度服务器通信时,如果交互失败,是否重试
26+
retryNumberOfRetries | 3 | 重试次数
27+
28+
examp
29+
``` yaml
30+
gray:
31+
server:
32+
url: http://gray-server
33+
loadbalanced: false
34+
retryable: true
35+
retryNumberOfRetries: 3
36+
```
37+
38+
39+
#### gray.client
40+
41+
Property Name | Default Value | Remarks
42+
--- | --- | ---
43+
runenv | web | 运行环境(默认web)
44+
serviceInitializeDelayTimeInMs | 40000 | 实始化灰度信息的延迟时间<默认40秒>
45+
serviceUpdateIntervalTimerInMs | 60000 | 定时从管控端更新灰度实例信息的间隔时间(默认60秒)<br/>0表示不创建定时任务
46+
47+
examp
48+
``` yaml
49+
gray:
50+
client:
51+
runenv: web
52+
serviceInitializeDelayTimeInMs: 40000
53+
serviceUpdateIntervalTimerInMs: 60000
54+
```
55+
56+
#### gray.client.instance
57+
实例自身相关的灰度参数,比如自动注册灰度实例。
58+
59+
Property Name | Default Value | Remarks
60+
--- | --- | ---
61+
grayEnroll | false | 是否自动注册为灰度服务,默认false
62+
grayEnrollDealyTimeInMs | 40000 | 触发自动注册的延迟时间
63+
64+
examp
65+
``` yaml
66+
gray:
67+
client:
68+
instance:
69+
grayEnroll: true
70+
grayEnrollDealyTimeInMs: 40000
71+
```
72+
73+
#### gray.client.caches
74+
缓存的配置属性,目前实例的灰度决策缓存策略(grayDecision)已应用
75+
76+
Property Name | Default Value | Remarks
77+
--- | --- | ---
78+
maximumSize | 1000 | 最大缓存数
79+
expireSeconds | 60 | 过期时间(秒)
80+
81+
examp
82+
``` yaml
83+
gray:
84+
client:
85+
caches:
86+
grayDecision:
87+
maximumSize: 1000
88+
expireSeconds: 60
89+
```
90+
91+
92+
#### gray.request
93+
http request相关的配置
94+
95+
Property Name | Default Value | Remarks
96+
--- | --- | ---
97+
loadBody | false | 是否记录请求body,不推荐
98+
99+
examp
100+
``` yaml
101+
gray:
102+
request:
103+
loadBody: false
104+
```
105+
106+
107+
#### gray.request.track
108+
灰度追踪相关的配置
109+
110+
Property Name | Default Value | Remarks
111+
--- | --- | ---
112+
enabled | true | 是否启用灰度追踪
113+
trackType | web | 追踪类型: web环境
114+
definitionsUpdateIntervalTimerInMs | 60000 | 定时从拉取最新的追踪信息的间隔时间
115+
definitionsInitializeDelayTimeInMs | 40000 | 初始化追踪信息的延迟时间
116+
117+
examp
118+
``` yaml
119+
gray:
120+
request:
121+
track:
122+
enabled: true
123+
trackType: web
124+
definitionsUpdateIntervalTimerInMs: 60000
125+
definitionsInitializeDelayTimeInMs: 40000
126+
```
127+
128+
129+
#### gray.request.track.web
130+
131+
Property Name | Default Value | Remarks
132+
--- | --- | ---
133+
pathPatterns | /* | Filter拦截的uri,多个用逗号分隔
134+
excludePathPatterns | | Filter拦截排除的uri,多个用逗号分隔
135+
136+
examp
137+
``` yaml
138+
gray:
139+
request:
140+
track:
141+
web:
142+
pathPatterns: /*
143+
excludePathPatterns: /static/*
144+
```
145+
146+
147+
148+
#### gray.request.track.web.trackDefinitions
149+
追踪项配置。
150+
这部分可以在项目中配置好,也可以在管控端编辑。优先级以管控端优先,项目配置次之。
151+
152+
Property Name | Default Value | Remarks
153+
--- | --- | ---
154+
name | | 追踪项的名称
155+
value | | 追踪项的内容(字段),多个用逗号分隔
156+
157+
examp
158+
``` yaml
159+
gray:
160+
request:
161+
track:
162+
web:
163+
trackDefinitions:
164+
name: HttpHeader
165+
value: varsion
166+
```
167+
168+
169+
#### gray.holdoutServer
170+
以ribbon的举例,ribbon在路由转发时,只会将请求转发给实例状态为up的Server。
171+
如果在新版本上线过程中,希望上线的实例不影响正常用户,同时又能在线上进行测试,这就需要ribbon能够将特定的请求转发给不是UP状态的实例。
172+
通过该配置,可以实现。
173+
174+
Property Name | Default Value | Remarks
175+
--- | --- | ---
176+
enabled | false | 是否开启
177+
services | | 配置服务可以被转发的实例状态,该参数为Map<String, List>类型
178+
zoneAffinity | false | 是否开启区域亲和
179+
cacheable | false | 是否缓存
180+
181+
examp
182+
``` yaml
183+
gray:
184+
holdout-server:
185+
enabled: false
186+
zoneAffinity: false
187+
cacheable: false
188+
services:
189+
service-a: STARTING
190+
```
191+
192+
193+
#### gray.hystrix
194+
Hystrix的相关配置
195+
196+
Property Name | Default Value | Remarks
197+
--- | --- | ---
198+
enabled | false | 是否加载灰度hystrix的相关配置与实现类
199+
threadTransmitStrategy | WRAP_CALLABLE | 线程变量传递策略,分别WRAP_CALLABLE,HYSTRIX_REQUEST_LOCAL_STORAGE。<br />{WRAP_CALLABLE: 使用com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy实现, HYSTRIX_REQUEST_LOCAL_STORAGE: 使用com.netflix.hystrix.strategy.concurrency.HystrixRequestVariableDefault实现}
200+
201+
examp
202+
``` yaml
203+
gray:
204+
hystrix:
205+
enabled: true
206+
threadTransmitStrategy: WRAP_CALLABLE
207+
```
208+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
2+
# SpringCloudGray 配置参数
3+
### 管控端
4+
#### gray.server.discovery
5+
6+
Property Name | Default Value | Remarks
7+
--- | --- | ---
8+
evictionEnabled | true | 定时同步注册中心实例状态的开关
9+
evictionIntervalTimerInMs | 60000 | 定时同步注册中心实例状态的时间间隔(默认60秒), 0表示不创建定时任务
10+
11+
examp
12+
``` yaml
13+
gray:
14+
server:
15+
discovery:
16+
evictionEnabled: true
17+
evictionIntervalTimerInMs: 60000
18+
```
19+
20+
#### gray.server.instance
21+
22+
Property Name | Default Value | Remarks
23+
--- | --- | ---
24+
normalInstanceStatus | STARTING,UP | 正常的实例状态,默认为STARTING, UP。<br/>实例状态分别是STARTING, UP, OUT_OF_SERVICE, DOWN, UNKNOWN
25+
26+
examp
27+
``` yaml
28+
gray:
29+
server:
30+
instance:
31+
normalInstanceStatus: STARTING,UP
32+
```
33+
34+
#### gray.server.instance.eviction
35+
36+
Property Name | Default Value | Remarks
37+
--- | --- | ---
38+
enabled | false | 是否启用实例记录清除任务(默认为false)
39+
evictionIntervalTimerInMs | 86400000 | 任务间隔时间,单位为毫秒(默认1天)
40+
evictionInstanceStatus | DOWN,UNKNOWN | 需要清徐的实例状态<br/>默认DOWN, UNKNOWN
41+
lastUpdateDateExpireDays | 1 | 最后更新时间过期天数<br/>默认1天
42+
43+
examp
44+
``` yaml
45+
gray:
46+
server:
47+
instance:
48+
eviction:
49+
enabled: true
50+
evictionIntervalTimerInMs: 86400000
51+
evictionInstanceStatus: DOWN,UNKNOWN
52+
lastUpdateDateExpireDays: 1
53+
```
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
## SpringCloudGray 部署
2+
Spring Cloud Gray 分为管控端,和客户端,管控端需要部署java管理服务和web操作界面。而客户端则简单很多,我们分别介绍下部署方式。
3+
4+
### 客户端
5+
#### 服务消费方添加jar包依赖
6+
maven工程在pom.xml中添加依赖
7+
```xml
8+
<dependency>
9+
<groupId>cn.springcloud.gray</groupId>
10+
<artifactId>spring-cloud-starter-gray-client</artifactId>
11+
<version>A.1.1.2</version>
12+
</dependency>
13+
<dependency>
14+
<groupId>cn.springcloud.gray</groupId>
15+
<artifactId>spring-cloud-gray-plugin-feign</artifactId>
16+
<version>A.1.1.2</version>
17+
</dependency>
18+
19+
```
20+
21+
#### zuul(网关)添加jar包依赖
22+
maven工程在pom.xml中添加依赖
23+
```xml
24+
<dependency>
25+
<groupId>cn.springcloud.gray</groupId>
26+
<artifactId>spring-cloud-starter-gray-client</artifactId>
27+
<version>A.1.1.2</version>
28+
</dependency>
29+
<dependency>
30+
<groupId>cn.springcloud.gray</groupId>
31+
<artifactId>spring-cloud-gray-plugin-zuul</artifactId>
32+
<version>A.1.1.2</version>
33+
</dependency>
34+
```
35+
36+
#### spring cloud gateway(网关)添加jar包依赖
37+
maven工程在pom.xml中添加依赖
38+
```xml
39+
<dependency>
40+
<groupId>cn.springcloud.gray</groupId>
41+
<artifactId>spring-cloud-starter-gray-client</artifactId>
42+
<version>B.0.0.2</version>
43+
<exclusions>
44+
<exclusion>
45+
<artifactId>spring-cloud-gray-plugin-webmvc</artifactId>
46+
<groupId>cn.springcloud.gray</groupId>
47+
</exclusion>
48+
<exclusion>
49+
<groupId>cn.springcloud.gray</groupId>
50+
<artifactId>spring-cloud-gray-plugin-eureka</artifactId>
51+
</exclusion>
52+
</exclusions>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>cn.springcloud.gray</groupId>
57+
<artifactId>spring-cloud-gray-plugin-gateway</artifactId>
58+
<version>B.0.0.2</version>
59+
</dependency>
60+
```
61+
62+

0 commit comments

Comments
 (0)