This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shenyu-website.git
The following commit(s) were added to refs/heads/main by this push:
new cc7a802b00 [fix:docs #674] Optimize shenyu configuration document.
(#691)
cc7a802b00 is described below
commit cc7a802b00d3b5f83a32ca862367c7d5a9da2c9b
Author: lahmxu <[email protected]>
AuthorDate: Tue Aug 9 14:30:36 2022 +0800
[fix:docs #674] Optimize shenyu configuration document. (#691)
---
.../property-config/admin-property-config.md | 20 +-
.../property-config/gateway-property-config.md | 312 +++++++++++-----
.../property-config/admin-property-config.md | 21 +-
.../property-config/gateway-property-config.md | 410 ++++++++++++++-------
4 files changed, 494 insertions(+), 269 deletions(-)
diff --git a/docs/user-guide/property-config/admin-property-config.md
b/docs/user-guide/property-config/admin-property-config.md
index 20cf3fed01..e38408685a 100644
--- a/docs/user-guide/property-config/admin-property-config.md
+++ b/docs/user-guide/property-config/admin-property-config.md
@@ -23,13 +23,11 @@ shenyu:
zombieCheckTimes: 5
scheduledTime: 10
nacosNameSpace: ShenyuRegisterCenter
- database:
- dialect: mysql
- init_script: "META-INF/schema.sql"
- init_enable: true
sync:
websocket:
enabled: true
+ messageMaxSize: 10240
+ allowOrigins: ws://localhost:9095;ws://localhost:9195;
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
@@ -85,7 +83,6 @@ shenyu:
- /csrf
swagger:
enable: true
-
```
@@ -144,17 +141,6 @@ When the registerType is `consul`, the supported
properties are as follows.
|metadata-path | String | `shenyu/register` | No
|Metadata path name, default is `shenyu/register`.|
-##### shenyu.database config
-
-Database configuration when `shenyu-admin` is started.
-
-
-|Name | Type | Default | Required | Description
|
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|dialect | String | h2 | No |which database is used when
admin is started.|
-|init_script | String | `META-INF/schema.h2.sql` | No
|database initialization script.|
-|init_enable | boolean | true | No |whether to
initialize.|
-
##### shenyu.sync config
@@ -166,6 +152,8 @@ The following properties are configured for data
synchronization using `websocke
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
|enabled | boolean | true | No |whether to enable
websocket for data synchronization.|
+|messageMaxSize | int | 0 | No |Set the `websocket` max buffer size in bytes.|
+|allowOrigins | String | "" | No |Set allowed `origins`, multiple parameters
separated by `;`.|
The following properties are configured for data synchronization using
`zookeeper` :
diff --git a/docs/user-guide/property-config/gateway-property-config.md
b/docs/user-guide/property-config/gateway-property-config.md
index b70d854920..34120dda88 100644
--- a/docs/user-guide/property-config/gateway-property-config.md
+++ b/docs/user-guide/property-config/gateway-property-config.md
@@ -12,6 +12,9 @@ This paper mainly explains how to configure `Apache ShenYu`
properties on the ga
```yaml
shenyu:
+ matchCache:
+ enabled: false
+ maxFreeMemory: 256 # 256MB
netty:
http:
webServerFactoryEnabled: true
@@ -90,6 +93,7 @@ shenyu:
sync:
websocket:
urls: ws://localhost:9095/websocket
+ allowOrigin: ws://localhost:9195
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
@@ -130,6 +134,7 @@ shenyu:
- c.apache.org
- d.apache.org
- http://e.apache.org
+ originRegex: ^http(|s)://(.*\.|)abc.com$
allowedExpose: ""
maxAge: "18000"
allowCredentials: true
@@ -142,6 +147,16 @@ shenyu:
enabled: false
paths:
- /favicon.ico
+ fallback:
+ enabled: false
+ paths:
+ - /fallback/hystrix
+ - /fallback/resilience4j
+ health:
+ enabled: false
+ paths:
+ - /actuator/health
+ - /health_check
extPlugin:
path:
enabled: true
@@ -160,13 +175,44 @@ shenyu:
interval: 5000
printEnabled: true
printInterval: 60000
+ ribbon:
+ serverListRefreshInterval: 10000
+ metrics:
+ enabled: false
+ name : prometheus
+ host: 127.0.0.1
+ port: 8090
+ jmxConfig:
+ props:
+ jvm_enabled: true
+ sharedPool:
+ enable: true
+ prefix: "shenyu-shared"
+ corePoolSize: 200
+ maximumPoolSize: 2000
+ keepAliveTime: 60000
+ maxWorkQueueMemory: 1073741824 # 1GB
+ maxFreeMemory: 268435456 # 256MB
```
### Property Detail
+
+
+##### shenyu.matchCache config
+
+The apache shenyu selector cache config.
+
+| Name | Type | Default | Required | Description
|
+| :------------ | :------ | :-----: | :------: |
:---------------------------------- |
+| enabled | Boolean | false | No | Whether to enable selector
caching. |
+| maxFreeMemory | Integer | 256MB | 否No | Maximum cache usage (MB).
|
+
+
+
##### shenyu.NettyTcpProperties config
-`ShenYu` Netty config
+The apache shenyu netty config.
| Name | Type | Default | Required | Description
|
|:------------------------------|:--------|:-------:|:--------:|:------------------------------------------------------------------------------------------------------------------------------------------|
@@ -210,9 +256,9 @@ This is the relevant configuration for the `ShenYu` gateway
to register to the r
| Name | Type | Default | Required | Description
|
| :----------- | :-----: | :------------: | :------: |
:----------------------------------------------------------- |
-| enabled | boolean | false | Yes | Whether to start
|
-| registerType | String | zookeeper | Yes | Which registry to use,
currently supports zookeeper, etcd |
-| serverLists | String | localhost:2181 | Yes | The address of the
register center. If using clusters, separate with `,` |
+| enabled | boolean | false | Yes | Whether to start.
|
+| registerType | String | zookeeper | Yes | Which registry to use,
currently supports zookeeper, etcd. |
+| serverLists | String | localhost:2181 | Yes | The address of the
register center. If using clusters, separate with `,`. |
| props | | | | When using different
register types, the attribute values are different. |
- `props` config
@@ -223,35 +269,35 @@ When the registerType is `zookeeper`, the supported
properties are as follows.
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|sessionTimeout | int | 30000 | No |session time
out(millisecond)|
-|connectionTimeout | int | 3000 | No |connection time
out(millisecond)|
+|sessionTimeout | int | 30000 | No |session time
out(millisecond).|
+|connectionTimeout | int | 3000 | No |connection time
out(millisecond).|
When the registerType is `etcd`, the supported properties are as follows.
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|etcdTimeout | int | 30000 | No |etcd time
out(millisecond)|
-|etcdTTL | int | 5 | No |client lease time to
live(second)|
+|etcdTimeout | int | 30000 | No |etcd time
out(millisecond).|
+|etcdTTL | int | 5 | No |client lease time to
live(second).|
##### shenyu.httpclient config
This is the HttpClient configuration used to send proxy requests after
proxying the Http and SpringCloud protocols in the `ShenYu` gateway.
-| Name | Type | Default | Required | Description
|
-| :------------- | :-----: | :-----------: | :------: |
:----------------------------------------------------------- |
-| strategy | String | webClient | No | Type of http client,
defaults to webClient.<br /> - webClient: use by WebClientPlugin<br />- netty:
use by NettyHttpClientPlugin. |
-| connectTimeout | int | 45000 | No | Connection timeout
(millisecond), the default value is 45000. |
-| responseTimeout| int | 3000 | No | The response timeout
(millisecond), the default value is 3000. |
-| readerIdleTime | int | 3000 | No | The reader idle
timeout (millisecond), the default value is 3000. |
-| writerIdleTime | int | 3000 | No | The writer idle
timeout (millisecond), the default value is 3000. |
-| allIdleTime | int | 3000 | No | The all idle timeout
(millisecond), the default value is 3000. |
-| readTimeout | int | 3000 | No | Read timeout
(millisecond), the default value is 3000. |
-| writeTimeout | int | 3000 | No | Write timeout
(millisecond), the default value is 3000. |
-| wiretap | Boolean | false | No | Enables wiretap
debugging for Netty HttpClient, the default value is 'false'. |
-| keepAlive | Boolean | false | No | Enable or Disable
Keep-Alive support for the outgoing request, the default value is 'false'. |
-| pool | | | | HttpClient connection
pool config |
-| proxy | | | | HttpClient proxy
config |
-| ssl | | | | HttpClient ssl config
|
+| Name | Type | Default | Required | Description
|
+| :-------------- | :-----: | :-------: | :------: |
:----------------------------------------------------------- |
+| strategy | String | webClient | No | Type of http client,
defaults to webClient.<br /> - webClient: use by WebClientPlugin<br />- netty:
use by NettyHttpClientPlugin. |
+| connectTimeout | int | 45000 | No | Connection timeout
(millisecond), the default value is 45000. |
+| responseTimeout | int | 3000 | No | The response timeout
(millisecond), the default value is 3000. |
+| readerIdleTime | int | 3000 | No | The reader idle timeout
(millisecond), the default value is 3000. |
+| writerIdleTime | int | 3000 | No | The writer idle timeout
(millisecond), the default value is 3000. |
+| allIdleTime | int | 3000 | No | The all idle timeout
(millisecond), the default value is 3000. |
+| readTimeout | int | 3000 | No | Read timeout
(millisecond), the default value is 3000. |
+| writeTimeout | int | 3000 | No | Write timeout
(millisecond), the default value is 3000. |
+| wiretap | Boolean | false | No | Enables wiretap debugging
for Netty HttpClient, the default value is 'false'. |
+| keepAlive | Boolean | false | No | Enable or Disable
Keep-Alive support for the outgoing request, the default value is 'false'. |
+| pool | | | | HttpClient connection
pool config. |
+| proxy | | | | HttpClient proxy config.
|
+| ssl | | | | HttpClient ssl config.
|
- `pool` config
@@ -261,8 +307,8 @@ HttpClient connection pool configuration:
| :------------- | :----: | :-------------------------------: | :------: |
:----------------------------------------------------------- |
| type | String | ELASTIC | No |
Type of pool for HttpClient to use, defaults to ELASTIC.<br /> - ELASTIC: The
connection pool can be cached and grown on demand<br />- FIXED: The connection
pool cache and reuse a fixed maximum The number of connections.<br />-
DISABLED: The connection pool will always create a new connection. |
| name | String | proxy | No | The
channel pool map name, defaults to proxy. |
-| maxConnections | int | the maximum value of 2*CPU and 16 | No |
Only for type FIXED, the maximum number of connections before starting pending
acquisition on existing ones.<br />the default value is available number of
processors*2. <br /> (but with a minimum value of 16) |
-| acquireTimeout | int | 45000 | No |
Only for type FIXED, the maximum time in millis to wait for acquiring. the
default value is 45000 |
+| maxConnections | int | the maximum value of 2*CPU and 16 | No |
Only for type FIXED, the maximum number of connections before starting pending
acquisition on existing ones.<br />the default value is available number of
processors*2. <br /> (but with a minimum value of 16). |
+| acquireTimeout | int | 45000 | No |
Only for type FIXED, the maximum time in millis to wait for acquiring. the
default value is 45000. |
| maxIdleTime | int | NULL | No |
After which the channel will be closed, if NULL there is no max idle time. |
- `proxy` config
@@ -275,7 +321,7 @@ Netty HttpClient proxy configuration:
| port | String | null | No | Port for proxy
configuration of Netty HttpClient. |
| username | String | null | No | Username for proxy
configuration of Netty HttpClient. |
| password | String | null | No | Password for proxy
configuration of Netty HttpClient. |
-| nonProxyHostsPattern | String | null | No | Regular expression
(Java) for a configured list of hosts. that should be reached directly,
bypassing the proxy |
+| nonProxyHostsPattern | String | null | No | Regular expression
(Java) for a configured list of hosts. that should be reached directly,
bypassing the proxy. |
- `SSL` config
@@ -284,23 +330,23 @@ Gateway routing can support routing to http and https
back-end services at the s
| Name | Type | Default | Required | Description
|
| :----------------------- | :-----: | :-----: | :------: |
:----------------------------------------------------------- |
| useInsecureTrustManager | Boolean | false | No | Installs the netty
InsecureTrustManagerFactory. This is insecure and not suitable for production. |
-| keyStoreType | String | PKCS12 | No | SSL key store
type. |
-| keyStorePath | String | | No | SSL key store
path. |
-| keyStorePassword | String | | No | SSL key store pass
word. |
-| keyStoreProvider | String | | No | SSL Keystore
provider for netty httpClient and webclient. |
-| keyPassword | String | | No | SSL key pass word.
|
+| keyStoreType | String | PKCS12 | No | SSL key store
type. |
+| keyStorePath | String | | No | SSL key store
path. |
+| keyStorePassword | String | | No | SSL key store pass
word. |
+| keyStoreProvider | String | | No | SSL Keystore
provider for netty httpClient and webclient. |
+| keyPassword | String | | No | SSL key pass word.
|
| trustedX509Certificates | String | Null | No | Trusted
certificates for verifying the remote endpoint's certificate.(Use `,` to
separate multiple values) |
| handshakeTimeout | int | 10000 | No | SSL handshake
timeout. Default to 10000 ms |
| closeNotifyFlushTimeout | int | 3000 | No | SSL close_notify
flush timeout. Default to 3000 ms. |
| closeNotifyReadTimeout | int | 0 | No | SSL close_notify
read timeout. Default to 0 ms. |
-| defaultConfigurationType | String | TCP | No | The default ssl
configuration type. Defaults to TCP.<br />- H2: SslProvider will be set
depending on OpenSsl.isAlpnSupported(), SslProvider.HTTP2_CIPHERS, ALPN
support, HTTP/1.1 and HTTP/2 support.<br />- TCP:
[`SslProvider`](https://netty.io/4.1/api/io/netty/handler/ssl/SslProvider.html?is-external=true)
will be set depending on `OpenSsl.isAvailable()`<br />- NONE: There will be no
default configuration |
+| defaultConfigurationType | String | TCP | No | The default ssl
configuration type. Defaults to TCP.<br />- H2: SslProvider will be set
depending on OpenSsl.isAlpnSupported(), SslProvider.HTTP2_CIPHERS, ALPN
support, HTTP/1.1 and HTTP/2 support.<br />- TCP:
[`SslProvider`](https://netty.io/4.1/api/io/netty/handler/ssl/SslProvider.html?is-external=true)
will be set depending on `OpenSsl.isAvailable()`.<br />- NONE: There will be
no default configuration. |
##### Filter Configuration
- `shenyu.file` config
-File filter properties:
+File filter properties.
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
@@ -313,38 +359,82 @@ File filter properties:
Cross filter properties:
-|Name | Type | Default | Required | Description
|
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | false | No | allow cross-domain requests |
-| allowedHeaders | String | x-requested-with, authorization, Content-Type,
Authorization, credential, X-XSRF-TOKEN, token, username, client | No |
allowedHeaders, Use "," split in multiple cases. the new "allowedHeaders" will
append to "Access-Control-Allow-Headers" based on the default value and remove
the reduplicative header. |
-| allowedMethods | String | "*" | No | allowedMethods |
-| allowedAnyOrigin | Boolean | false | No | Whether to allow any
Origin, if it is true, directly set the `Access-Control-Allow-Origin` to the
same value as the Origin, that is, `request.getHeaders().getOrigin()`, and
discard the `allowedOrigin` configuration. |
-| allowedOrigin | AllowedOriginConfig | - | No | Configure `domain`
such as apache.org, domain name `prefixes` such as a, b and `spacer` such as
"." or directly use `origins` configuration such as c.apche.org,
http://d.apache.org. If `Origin` is http://a.apache.org or http://b.apache.org
or http://c.apache.org or http://d.apache.org, the value of
`Access-Control-Allow-Origin` is the same as `Origin`, that is,
`request.getHeaders( ).getOrigin()` |
-| allowedExpose | String | "" | No | allowedExpose |
-| maxAge | String | "18000" | No | maxAge (ms) |
-| allowCredentials | Boolean | true | No | allowCredentials |
+|Name | | Type | Default |
Required | Description |
+|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|:---------------------------:|
+| enabled | | Boolean | false | No | allow cross-domain requests |
+| allowedHeaders | | String | x-requested-with, authorization, Content-Type,
Authorization, credential, X-XSRF-TOKEN, token, username, client | No |
allowedHeaders, Use "," split in multiple cases. the new "allowedHeaders" will
append to "Access-Control-Allow-Headers" based on the default value and remove
the reduplicative header. |
+| allowedMethods | | String | "*" | No | allowedMethods |
+| allowedAnyOrigin | | Boolean | false | No | Whether to allow any
Origin, if it is true, directly set the `Access-Control-Allow-Origin` to the
same value as the Origin, that is, `request.getHeaders().getOrigin()`, and
discard the `allowedOrigin` configuration. |
+| allowedOrigin | | AllowedOriginConfig | - | No | Set the allowed
request sources. |
+| | spacer | String | "" | No | Set the allowed subdomains, need to use with
`domain`, `prefixes`. |
+| | domain | String | "" | No | Set the allowed subdomains, need to use with
`domain`, `prefixes`. |
+| | prefixes | Set | [] | No | Set the allowed subdomains, need to use with
`domain`, `prefixes`. |
+| | origins | Set | null | No | Set the domain names that are allowed to be
accessed, which can be used separately. |
+| | originRegex | String | "" | No | Set up access to domains that allow
regular matching, available separately. |
+| allowedExpose | | String | "" | No | allowedExpose |
+| maxAge | | String | "18000" | No | maxAge (ms) |
+| allowCredentials | | Boolean | true | No | allowCredentials |
- `shenyu.exclude` config
-Exculde filter properties:
+Exculde filter properties.
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | false | No | whether to enable `exclude filter`
and reject the specified request to pass through the gateway |
-| paths | Array | null | Yes | Requests matching this list can
not pass through the gateway (support Path-Matching) |
+| enabled | Boolean | false | No | whether to enable `exclude filter`
and reject the specified request to pass through the gateway. |
+| paths | Array | null | Yes | Requests matching this list can
not pass through the gateway (support Path-Matching). |
+
+- `shenyu.fallback` config
+
+Related configuration of fallback response.
+
+| Name | Type | Default | Required | Description
|
+| :------ | :------ | :-----: | :------: |
:---------------------------------------- |
+| enabled | Boolean | false | No | Whether to turn on the fallback
response. |
+| paths | Array | [] | Yes | Address of the service fallback
request. |
+
+- `shenyu.health` config
+
+Configuration related to service health status.
+
+| Name | Type | Default | Required |
Description |
+| :------ | :------ |:----------------------------------------:| :------: |
:-------------------------------------- |
+| enabled | Boolean | false | No |
Whether to turn on health detection. |
+| paths | Array | `"/actuator/health"` 、`"/health_check"` | No |
Set up service health monitoring paths. |
+
+- `shenyu.local` config
+
+Local forwarding-related configuration.
+
+| Name | Type | Default | Required | Description
|
+| :-------- | :------ | :-----: | :------: |
:----------------------------------------------------------- |
+| enabled | Boolean | false | No | Whether to enable local
forwarding. |
+| sha512Key | String | "" | Yes | Secret key, according to the
secret key to determine whether the need for local forwarding. |
+
+
+
+##### shenyu.switchConfig config
+
+The apache shenyu switch configuration.
+
+| Name | Type | Default | Required | Description
|
+| :---- | :------ | :-----: | :------: |
:----------------------------------------------------------- |
+| local | Boolean | true | No | Whether to open local mode, if so,
local operation data, default open. |
+
##### shenyu.sync config
-The Apache ShenYu gateway and the Admin System use data synchronization
configurations.
+The apache shenyu gateway and the Admin System use data synchronization
configurations.
The following properties are configured for data synchronization using
`websocket` :
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| urls | String | null | Yes | The websocket server address of
`Admin`, separate multiple addresses with `,` |
+| urls | String | null | Yes | The websocket server address of
`Admin`, separate multiple addresses with `,`. |
+| allowOrigin | String | "" | No | Set the allowed `origins`, with multiple
parameters separated by `;`. |
@@ -353,9 +443,9 @@ The following properties are configured for data
synchronization using `zookeepe
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|url | String | null | Yes |zookeeper server url|
-|sessionTimeout | int | null | Yes |session timeout
(millisecond)|
-|connectionTimeout | int | null | Yes |connection timeout
(millisecond)|
+|url | String | null | Yes |zookeeper server url.|
+|sessionTimeout | int | null | Yes |session timeout
(millisecond).|
+|connectionTimeout | int | null | Yes |connection timeout
(millisecond).|
@@ -363,29 +453,24 @@ The following properties are configured for data
synchronization using `http lon
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| url | String | null | Yes | `Admin` server address |
+| url | String | null | Yes | `Admin` server address. |
The following properties are configured for data synchronization using `nacos`
:
-|Name | Type | Default | Required | Description
|
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|url | String | null | 是 |nacos url|
-|namespace | String | null | Yes |namespace|
-|username | String | null | No |username|
-|password | String | null | No |password|
-|acm | | | No |aliyun ACM service configuration|
-
-- `acm` config
-
-|Name | Type | Default | Required | Description
|
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|enabled | boolean | false | No |whether to enable|
-|endpoint | String | null | No |ACM service address|
-|namespace | String | null | No |namespace|
-|accessKey | String | null | No |accessKey|
-|secretKey | String | null | No |secretKey|
+|Name | | Type | Default |
Required | Description |
+|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|:---------------------------:|
+|url | | String | null | 是 |nacos url|
+|namespace | | String | null | Yes
|namespace|
+|username | | String | null | No |username|
+|password | | String | null | No |password|
+|acm | | Object | - | No |aliyun ACM service
configuration.|
+| |enabled | boolean | false | No |whether to enable.|
+| |endpoint | String | null | No |ACM service address.|
+| |namespace | String | null | No |namespace.|
+| |accessKey | String | null | No |accessKey.|
+| |secretKey | String | null | No |secretKey.|
@@ -393,7 +478,7 @@ The following properties are configured for data
synchronization using `etcd` :
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|url | String | null | Yes |`etcd` server url|
+|url | String | null | Yes |`etcd` server url.|
@@ -401,52 +486,87 @@ The following properties are configured for data
synchronization using `consul`
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|url | String | null | Yes |`consul` server url|
-| waitTime | int | null | Yes | the timeout period for requesting
consul service to pull configuration information (milliseconds) |
-|watchDelay | int | null | Yes |Synchronization interval (milliseconds)|
+|url | String | null | Yes |`consul` server url.|
+| waitTime | int | null | Yes | the timeout period for requesting
consul service to pull configuration information (milliseconds). |
+|watchDelay | int | null | Yes |Synchronization interval (milliseconds).|
##### shenyu.extPlugin config
-The Apache ShenYu Supports dynamic loading of custom plug-ins with the
following configuration
+The apache shenyu supports dynamic loading of custom plug-ins with the
following configuration
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | true | No | open dynamic loading of custom
plug-ins |
-| path | String | | False | custom plugins path, if not config, the
path is /ext/lib |
-| threads | Integer | 1 | False | threads for dynamic loading custom
plug-ins |
-| scheduleTime | Integer | 300 | False | schedule time (s) for dynamic
loading custom plug-ins |
-| scheduleDelay | Integer | 30 | False | schedule delay when app
startup|
+| enabled | Boolean | true | No | open dynamic loading of custom
plug-ins. |
+| path | String | | False | custom plugins path, if not config, the
path is /ext/lib. |
+| threads | Integer | 1 | False | threads for dynamic loading custom
plug-ins. |
+| scheduleTime | Integer | 300 | False | schedule time (s) for dynamic
loading custom plug-ins. |
+| scheduleDelay | Integer | 30 | False | schedule delay when app
startup. |
##### shenyu.scheduler config
-scheduler config for Apache ShenYu Scheduler Thread Model
+Scheduler config for apache shenyu scheduler thread model.
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | false | No | Whether to turn on Scheduler Thread
Model |
-| type | String | fixed | False | fixed Thread Pool or elastic
Scheduler Thread Model|
-| threads | Integer | Math.max((Runtime.getRuntime().availableProcessors()
<< 1) + 1, 16) | False | threads for fixed Thread Pool |
+| enabled | Boolean | false | No | Whether to turn on Scheduler Thread
Model. |
+| type | String | fixed | False | fixed Thread Pool or elastic
Scheduler Thread Model. |
+| threads | Integer | Math.max((Runtime.getRuntime().availableProcessors()
<< 1) + 1, 16) | False | threads for fixed Thread Pool. |
##### shenyu.upstreamCheck config
-upstreamCheck config is the configuration used by Apache ShenYu to detect
upstream
+UpstreamCheck config is the configuration used by apache shenyu to detect
upstream.
|Name | Type | Default | Required | Description
|
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | false | No | Whether to turn on upstreamCheck |
-| timeout | Integer | 3000 | False | timeout (ms) |
-| healthyThreshold | Integer | 1 | False | healthyThreshold |
-| unhealthyThreshold | Integer | 1 | False | unhealthyThreshold |
-| interval | Integer | 5000 | False | schedule time (ms) for checked |
-| printEnabled | Boolean | true | No | Whether to turn on print logs |
-| printInterval | Integer | 60000 | False | schedule time (ms) for
print logs |
+| enabled | Boolean | false | No | Whether to turn on upstreamCheck. |
+| timeout | Integer | 3000 | No | timeout (ms). |
+| healthyThreshold | Integer | 1 | No | healthyThreshold. |
+| unhealthyThreshold | Integer | 1 | No | unhealthyThreshold. |
+| interval | Integer | 5000 | No | schedule time (ms) for checked. |
+| printEnabled | Boolean | true | No | Whether to turn on print logs. |
+| printInterval | Integer | 60000 | No | schedule time (ms) for print
logs. |
-##### shenyu.switchConfig config
-Apache ShenYu Switch Config
-|Name | Type | Default | Required | Description
|
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| local | Boolean | true | No | Whether to open local mode, if so,
local operation data, default open |
+##### shenyu.ribbon config
+
+The apache shenyu polling interval configuration.
+
+| Name | Type | Default | Required | Description
|
+| :------------------------ | :------ | :-----: | :------: |
:----------------------------------------------------------- |
+| serverListRefreshInterval | Integer | 10000 | No | Adjust the
refresh interval parameter, refer
to`com.netflix.client.config.CommonClientConfigKey#ServerListRefreshInterval`. |
+
+
+
+##### shenyu.metrics config
+
+The apache shenyu metrics config,the gateway is used to monitor its own
operational status.
+
+| Name | | Type | Default | Required | Description
|
+| :-------- | :---------- | :-----: | :-----: | :------- |
------------------------------------------------------------ |
+| enabled | | Boolean | false | No | Whether to enable
metrics, true means enable. |
+| name | | String | "" | No | name.
|
+| host | | String | "" | No | IP exposed by the
gateway service to the collection service. |
+| port | | Integer | Null | No | Port exposed by the
gateway service to the collection service. |
+| jmxConfig | | String | "" | No | jmx config.
|
+| props | | - | | No | properties.
|
+| | jvm_enabled | Boolean | Null | No | Turn on jvm's
monitoring metrics. |
+
+
+
+##### shenyu.sharedPool config
+
+The apache shenyu shared thread pool configuration.
+
+| Name | Type | Default
| Required | Description |
+| :----------------- | ------- |
:---------------------------------------------- | :------: |
:-------------------------------------------------: |
+| enabled | Boolean | false
| No | Whether to enable shared thread pooling. |
+| prefix | String | "shenyu-shared"
| No | Thread pool name prefix. |
+| corePoolSize | Integer | 200
| No | Number of core threads in the thread pool. |
+| maximumPoolSize | Integer | Integer.MAX_VALUE
| No | Maximum number of threads in the thread pool. |
+| keepAliveTime | Long | 60000L
| No | Excess idle thread keepAlive time, in milliseconds. |
+| maxWorkQueueMemory | Long | 80% of the current JVM maximum available
memory | No | Maximum memory used (byte). |
+| maxFreeMemory | Integer | 无
| No | Maximum remaining memory (byte). |
+
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/admin-property-config.md
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/admin-property-config.md
index d675872bd7..b376228158 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/admin-property-config.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/admin-property-config.md
@@ -24,13 +24,11 @@ shenyu:
zombieCheckTimes: 5
scheduledTime: 10
nacosNameSpace: ShenyuRegisterCenter
- database:
- dialect: mysql
- init_script: "META-INF/schema.sql"
- init_enable: true
sync:
websocket:
enabled: true
+ messageMaxSize: 10240
+ allowOrigins: ws://localhost:9095;ws://localhost:9195;
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
@@ -86,7 +84,6 @@ shenyu:
- /csrf
swagger:
enable: true
-
```
@@ -145,16 +142,6 @@ shenyu:
|metadata-path | String | `shenyu/register` | 否
|`Metadata`路径名称,默认是`shenyu/register`。|
-##### shenyu.database 配置
-
-`shenyu-admin`启动时,数据库的相关配置。
-
-|名称 | 类型 | 默认值 | 是否必填 | 说明 |
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-|dialect | String | h2 | 否 |admin启动时,使用哪种数据库。|
-|init_script | String | `META-INF/schema.h2.sql` | 否
|数据库初始化脚本|
-|init_enable | boolean | true | 否 |是否进行初始化|
-
##### shenyu.sync 配置
@@ -166,8 +153,10 @@ shenyu:
|名称 | 类型 | 默认值 | 是否必填 | 说明 |
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
|enabled | boolean | true | 否 |是否启用`websocket`进行数据同步|
+|messageMaxSize | int | 0 | 否 |设置`websocket`缓冲区大小,单位为bytes|
+|allowOrigins | String | 空字符串 | 否 |设置允许的 `origins`, 多个参数以`;`分隔|
-使用`zookeeper`进行数据同步的属性配置如下:
+使用`zookeeper`进行数据同步的属性配置如下:/
|名称 | 类型 | 默认值 | 是否必填 | 说明 |
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
index a6198117dc..3f36802bee 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/property-config/gateway-property-config.md
@@ -12,6 +12,9 @@ description: 网关属性配置
```yaml
shenyu:
+ matchCache:
+ enabled: false
+ maxFreeMemory: 256 # 256MB
netty:
http:
webServerFactoryEnabled: true
@@ -90,6 +93,7 @@ shenyu:
sync:
websocket:
urls: ws://localhost:9095/websocket
+ allowOrigin: ws://localhost:9195
# zookeeper:
# url: localhost:2181
# sessionTimeout: 5000
@@ -130,6 +134,8 @@ shenyu:
- c.apache.org
- d.apache.org
- http://e.apache.org
+ originRegex: ^http(|s)://(.*\.|)abc.com$
+ allowedExpose: ""
maxAge: "18000"
allowCredentials: true
switchConfig:
@@ -141,6 +147,16 @@ shenyu:
enabled: false
paths:
- /favicon.ico
+ fallback:
+ enabled: false
+ paths:
+ - /fallback/hystrix
+ - /fallback/resilience4j
+ health:
+ enabled: false
+ paths:
+ - /actuator/health
+ - /health_check
extPlugin:
path:
enabled: true
@@ -159,53 +175,86 @@ shenyu:
interval: 5000
printEnabled: true
printInterval: 60000
+ ribbon:
+ serverListRefreshInterval: 10000
+ metrics:
+ enabled: false
+ name : prometheus
+ host: 127.0.0.1
+ port: 8090
+ jmxConfig:
+ props:
+ jvm_enabled: true
+ sharedPool:
+ enable: true
+ prefix: "shenyu-shared"
+ corePoolSize: 200
+ maximumPoolSize: 2000
+ keepAliveTime: 60000
+ maxWorkQueueMemory: 1073741824 # 1GB
+ maxFreeMemory: 268435456 # 256MB
```
### 属性详解
+
+
+##### shenyu.matchCache 配置
+
+Apache ShenYu 选择器缓存配置
+
+| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
+|:------------------------------|:-----
|:-------:|:--------:|:------------------------------------------------------------|
+| enabled | Boolean | false | 否 | 是否开启选择器缓存 |
+| maxFreeMemory | Integer | 256MB | 否 | 最大缓存占用,单位MB |
+
+
+
##### shenyu.NettyTcpProperties 配置
-`ShenYu` Netty 配置
+Apache ShenYu Netty 配置
-| Name | Type | Default | Required | Description
|
+| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
|:------------------------------|:-----
|:-------:|:--------:|:------------------------------------------------------------|
-| webServerFactoryEnabled | Boolean | true | No |
是否开启自定义参数,true-开启,false-可以自行配置NettyReactiveWebServerFactory |
-| selectCount | Integer | 1 | No | Netty 选择器数
|
-| workerCount | Integer | 4 | No | Netty 工作线程数
|
-| accessLog | Boolean | false | No | netty request
parameters. |
+| webServerFactoryEnabled | Boolean | true | 否 |
是否开启自定义参数,true-开启,false-可以自行配置NettyReactiveWebServerFactory |
+| selectCount | Integer | 1 | 否 | Netty 选择器数
|
+| workerCount | Integer | 4 | 否 | Netty 工作线程数
|
+| accessLog | Boolean | false | 否 | netty request
parameters. |
| **ServerSocketChannelConfig** | | | |
|
-| soRcvBuf | Integer | 87380 | No |
Socket参数,TCP数据接收缓冲区大小 |
-| soBackLog | Integer | 128 | No |
Socket参数,服务端接受连接的队列长度 |
-| soReuseAddr | Boolean | false | No | Socket
参数,是否复用地址 |
-| connectTimeoutMillis | Integer | 10000 | No | Netty
参数,连接超时时间 |
-| writeBufferHighWaterMark | Integer | 65536 | No | Netty
参数,通道水位线上限 |
-| writeBufferLowWaterMark | Integer | 32768 | No | Netty
参数,通道水位线下限 |
-| writeSpinCount | Integer | 16 | No |
Netty参数,一个Loop写操作执行的最大次数 |
-| autoRead | Boolean | true | No | Netty参数,自动读取
|
-| allocType | String | pooled | No |
Netty参数,ByteBuf的分配器 |
-| messageSizeEstimator | Integer | 8 | No | Netty参数,
消息大小估算器, 用于估算ByteBuf,ByteBufHolder和FileRegion大小 |
-| singleEventExecutorPerGroup | Boolean | true | No | Netty参数,
单线程执行ChannelPipeline中的事件 |
+| soRcvBuf | Integer | 87380 | 否 |
Socket参数,TCP数据接收缓冲区大小 |
+| soBackLog | Integer | 128 | 否 |
Socket参数,服务端接受连接的队列长度 |
+| soReuseAddr | Boolean | false | 否 | Socket
参数,是否复用地址 |
+| connectTimeoutMillis | Integer | 10000 | 否 | Netty
参数,连接超时时间 |
+| writeBufferHighWaterMark | Integer | 65536 | 否 | Netty
参数,通道水位线上限 |
+| writeBufferLowWaterMark | Integer | 32768 | 否 | Netty
参数,通道水位线下限 |
+| writeSpinCount | Integer | 16 | 否 |
Netty参数,一个Loop写操作执行的最大次数 |
+| autoRead | Boolean | true | 否 | Netty参数,自动读取
|
+| allocType | String | pooled | 否 |
Netty参数,ByteBuf的分配器 |
+| messageSizeEstimator | Integer | 8 | 否 | Netty参数,
消息大小估算器, 用于估算ByteBuf,ByteBufHolder和FileRegion大小 |
+| singleEventExecutorPerGroup | Boolean | true | 否 | Netty参数,
单线程执行ChannelPipeline中的事件 |
| **SocketChannelConfig** | | | |
|
-| soKeepAlive | Boolean | false | No | Socket
参数,是否启用心跳保活机制 |
-| soReuseAddr | Boolean | false | No | Socket
参数,是否复用地址 |
-| soLinger | Integer | -1 | No | Socket 参数,关闭
Socket 的延迟时间 |
-| tcpNoDelay | Boolean | true | No | Socket
参数,是否启用 Nagle 算法 |
-| soRcvBuf | Integer | 87380 | No |
Socket参数,TCP数据接收缓冲区大小 |
-| soSndBuf | Integer | 128 | No |
|
-| ipTos | Integer | 0 | No |
IP参数,设置IP头部的Type-of-Service字段,用于描述IP包的优先级和QoS选项 |
-| allowHalfClosure | Boolean | false | No |
Netty参数,一个连接的远端关闭时本地端是否关闭 |
-| connectTimeoutMillis | Integer | 10000 | No | Netty
参数,连接超时时间 |
-| writeBufferHighWaterMark | Integer | 65536 | No | Netty
参数,通道水位线上限 |
-| writeBufferLowWaterMark | Integer | 32768 | No | Netty
参数,通道水位线下限 |
-| writeSpinCount | Integer | 16 | No |
Netty参数,一个Loop写操作执行的最大次数 |
-| autoRead | Boolean | true | No | Netty参数,自动读取
|
-| allocType | String | pooled | No |
Netty参数,ByteBuf的分配器 |
-| messageSizeEstimator | Integer | 8 | No | Netty参数,
消息大小估算器, 用于估算ByteBuf,ByteBufHolder和FileRegion大小 |
-| singleEventExecutorPerGroup | Boolean | true | No | Netty参数,
单线程执行ChannelPipeline中的事件 |
+| soKeepAlive | Boolean | false | 否 | Socket
参数,是否启用心跳保活机制 |
+| soReuseAddr | Boolean | false | 否 | Socket
参数,是否复用地址 |
+| soLinger | Integer | -1 | 否 | Socket 参数,关闭
Socket 的延迟时间 |
+| tcpNoDelay | Boolean | true | 否 | Socket 参数,是否启用
Nagle 算法 |
+| soRcvBuf | Integer | 87380 | 否 |
Socket参数,TCP数据接收缓冲区大小 |
+| soSndBuf | Integer | 128 | 否 |
Socket参数,TCP数据发送缓冲区大小 |
+| ipTos | Integer | 0 | 否 |
IP参数,设置IP头部的Type-of-Service字段,用于描述IP包的优先级和QoS选项 |
+| allowHalfClosure | Boolean | false | 否 |
Netty参数,一个连接的远端关闭时本地端是否关闭 |
+| connectTimeoutMillis | Integer | 10000 | 否 | Netty
参数,连接超时时间 |
+| writeBufferHighWaterMark | Integer | 65536 | 否 | Netty
参数,通道水位线上限 |
+| writeBufferLowWaterMark | Integer | 32768 | 否 | Netty
参数,通道水位线下限 |
+| writeSpinCount | Integer | 16 | 否 |
Netty参数,一个Loop写操作执行的最大次数 |
+| autoRead | Boolean | true | 否 | Netty参数,自动读取
|
+| allocType | String | pooled | 否 |
Netty参数,ByteBuf的分配器 |
+| messageSizeEstimator | Integer | 8 | 否 | Netty参数,
消息大小估算器, 用于估算ByteBuf,ByteBufHolder和FileRegion大小 |
+| singleEventExecutorPerGroup | Boolean | true | 否 | Netty参数,
单线程执行ChannelPipeline中的事件 |
+
+
##### shenyu.instance 配置
-这是 `ShenYu` 网关注册到注册中心的相关配置,注册中心配置请参考 [注册中心配置](../register-center-instance.md) 。
+Apache ShenYu 网关注册到注册中心的相关配置,注册中心配置请参考
[注册中心配置](../register-center-instance.md)
| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
| :----------- | :-----: | :------------: | :------: |
:---------------------------------------- |
@@ -216,7 +265,7 @@ shenyu:
- `props`配置
-使用不同的注册中心时,属性取值不同。
+使用不同的注册中心时,属性取值不同
当注册类型为 `zookeeper` 时,支持的属性配置如下:
@@ -232,67 +281,69 @@ shenyu:
|etcdTimeout | int | 30000 | 否 |etcd超时时间(毫秒)|
|etcdTTL | int | 5 | 否 |租约生存时间(秒)|
+
+
##### shenyu.httpclient 配置
-这是 `ShenYu` 网关中代理Http及SpringCloud协议后,用于发送代理请求的HttpClient配置。
-
-| Name | Type | Default | Required | Description
|
-| :------------- | :-----: | :-----------: | :------: |
:----------------------------------------------------------- |
-| strategy | String | webClient | No |
HttpClientPlugin实现策略(默认使用webClietnt):<br />- `webClient`:使用WebClientPlugin<br
/>- `netty`:使用NettyHttpClientPlugin |
-| connectTimeout | int | 45000 | No | 连接超时时间 (毫秒),默认值为
`45000`。 |
-| responseTimeout| int | 3000 | No | 结果超时时间 (毫秒),默认值为
`3000`。 |
-| readerIdleTime | int | 3000 | No | 指定读空闲超时时间 (毫秒),默认值为
`3000`。 |
-| writerIdleTime | int | 3000 | No | 指定写空闲超时时间 (毫秒),默认值为
`3000`。 |
-| allIdleTime | int | 3000 | No | 指定读和写超时时间 (毫秒),默认值为
`3000`。 |
-| readTimeout | int | 3000 | No | 读取超时 (毫秒),默认值为 `3000`。
|
-| writeTimeout | int | 3000 | No | 输出超时
(millisecond),默认值为 `3000`。 |
-| wiretap | Boolean | false | No | 启用 Netty HttpClient
的窃听调试,默认值为 `false`。 |
-| keepAlive | Boolean | false | No | 启用或禁用请求的 Keep-Alive
支持,默认值为 `false`。 |
-| pool | | | | HttpClient 连接池配置
|
-| proxy | | | | HttpClient 代理配置
|
-| ssl | | | | HttpClient SSL配置
|
+Apache ShenYu 网关中代理Http及SpringCloud协议后,用于发送代理请求的HttpClient配置
+
+| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
+| :-------------- | :-----: | :-------: | :------: |
:----------------------------------------------------------- |
+| strategy | String | webClient | No |
HttpClientPlugin实现策略(默认使用webClietnt):<br />- `webClient`:使用WebClientPlugin<br
/>- `netty`:使用NettyHttpClientPlugin |
+| connectTimeout | int | 45000 | No | 连接超时时间 (毫秒),默认值为 `45000`。
|
+| responseTimeout | int | 3000 | No | 结果超时时间 (毫秒),默认值为 `3000`。
|
+| readerIdleTime | int | 3000 | No | 指定读空闲超时时间 (毫秒),默认值为
`3000`。 |
+| writerIdleTime | int | 3000 | No | 指定写空闲超时时间 (毫秒),默认值为
`3000`。 |
+| allIdleTime | int | 3000 | No | 指定读和写超时时间 (毫秒),默认值为
`3000`。 |
+| readTimeout | int | 3000 | No | 读取超时 (毫秒),默认值为 `3000`。
|
+| writeTimeout | int | 3000 | No | 输出超时 (millisecond),默认值为
`3000`。 |
+| wiretap | Boolean | false | No | 启用 Netty HttpClient
的窃听调试,默认值为 `false`。 |
+| keepAlive | Boolean | false | No | 启用或禁用请求的 Keep-Alive
支持,默认值为 `false`。 |
+| pool | | | | HttpClient 连接池配置
|
+| proxy | | | | HttpClient 代理配置
|
+| ssl | | | | HttpClient SSL配置
|
- `pool` config
-HttpClient连接池配置:
+HttpClient连接池配置
-| Name | Type | Default | Required |
Description |
+| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
| :------------- | :----: | :------------------------: | :------: |
:----------------------------------------------------------- |
| type | String | ELASTIC | No |
HttpClient连接池类型,默认值为`ELASTIC`。<br /> - `ELASTIC`: 连接池可以按需缓存和增长。<br />- `FIXED`:
连接池缓存并重用,有固定的最大连接数。<br />- `DISABLED`: 连接池总是会创建一个新的连接。 |
| name | String | proxy | No |
连接池映射名称,默认为`proxy`。 |
| maxConnections | int | 2*可用处理器数,最小值为16 | No | 仅适用于 `FIXED`
类型,在现有连接上开始挂起获取之前的最大连接数。<br />默认值为可用处理器数*2。<br /> (最小值为 16) |
| acquireTimeout | int | 45000 | No | 仅适用于
`FIXED` 类型,等待获取连接的最长时间(毫秒)。默认值为 45000 |
-| maxIdleTime | int | NULL | No | Channel
空闲多久关闭,如果为空,没有最大空闲关闭时间。 |
+| maxIdleTime | int | Null | No | Channel
空闲多久关闭,如果为空,没有最大空闲关闭时间。 |
-- `Proxy` config
+- `Proxy` 配置
-Netty HttpClient 代理的相关配置:
+Netty HttpClient 代理的相关配置
-| Name | Type | Default | Required | Description
|
-| :------------------- | :----: | :-----: | :------: |
:---------------------------------- |
-| host | String | null | No | Netty HttpClient
代理配置的主机名。 |
-| port | String | null | No | Netty HttpClient
的代理配置端口。 |
-| username | String | null | No | Netty HttpClient
代理配置的用户名。 |
-| password | String | null | No | Netty HttpClient
代理配置的密码。 |
-| nonProxyHostsPattern | String | null | No | 直连的主机列表的正则表达式 (Java)。 |
+| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
+| :------------------- | :----: | :----: | :------: |
:---------------------------------- |
+| host | String | Null | No | Netty HttpClient
代理配置的主机名。 |
+| port | String | Null | No | Netty HttpClient
的代理配置端口。 |
+| username | String | Null | No | Netty HttpClient
代理配置的用户名。 |
+| password | String | Null | No | Netty HttpClient
代理配置的密码。 |
+| nonProxyHostsPattern | String | Null | No | 直连的主机列表的正则表达式 (Java)。 |
-- `SSL` config
+- `SSL` 配置
-网关路由可以同时支持路由到http和https的后端服务,以下为SSL相关配置:
+网关路由可以同时支持路由到http和https的后端服务,以下为SSL相关配置:
-| Name | Type | Default | Required | Description
|
-| :----------------------- | :-----: | :-----: | :------: |
:----------------------------------------------------------- |
-| useInsecureTrustManager | Boolean | false | No |
是否信任所有下游证书,默认`false`。 |
-| keyStoreType | String | PKCS12 | No | SSL 证书类型。
|
-| keyStorePath | String | | No | SSL 证书路径,可以放在
classpath 下。 |
-| keyStorePassword | String | | No | SSL 证书密码。
|
-| keyStoreProvider | String | | No | SSL 证书提供者。
|
-| keyPassword | String | | No | SSL 证书Key的密码。
|
-| trustedX509Certificates | Array | Null | No | 配置自己的信任的证书列表。
|
-| handshakeTimeout | int | 10000 | No | SSL握手超时时间(毫秒),默认值为
`10000`。 |
-| closeNotifyFlushTimeout | int | 3000 | No | SSL close_notify
刷新超时(毫秒)默认值为 `3000`。 |
-| closeNotifyReadTimeout | int | 0 | No | SSL close_notify
读取超时(毫秒)默认值为 `0`。 |
-| defaultConfigurationType | String | TCP | No | SslContextBuilder
的默认配置, 默认为 TCP.<br />- H2: SslProvider 将根据
OpenSsl.isAlpnSupported()、SslProvider.HTTP2_CIPHERS、ALPN 支持、HTTP/1.1 和 HTTP/2
支持进行设置<br />- TCP: SslProvider 将根据 OpenSsl.isAvailable() 设置<br />- NONE:
不会有默认配置 |
+| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
+| :----------------------- | :-----: | :----: | :------: |
:----------------------------------------------------------- |
+| useInsecureTrustManager | Boolean | false | 否 |
是否信任所有下游证书,默认`false`。 |
+| keyStoreType | String | PKCS12 | 否 | SSL 证书类型。
|
+| keyStorePath | String | | 否 | SSL 证书路径,可以放在
classpath 下。 |
+| keyStorePassword | String | | 否 | SSL 证书密码。
|
+| keyStoreProvider | String | | 否 | SSL 证书提供者。
|
+| keyPassword | String | | 否 | SSL 证书Key的密码。
|
+| trustedX509Certificates | Array | Null | 否 | 配置自己的信任的证书列表。
|
+| handshakeTimeout | int | 10000 | 否 | SSL握手超时时间(毫秒),默认值为
`10000`。 |
+| closeNotifyFlushTimeout | int | 3000 | 否 | SSL close_notify
刷新超时(毫秒)默认值为 `3000`。 |
+| closeNotifyReadTimeout | int | 0 | 否 | SSL close_notify
读取超时(毫秒)默认值为 `0`。 |
+| defaultConfigurationType | String | TCP | 否 | SslContextBuilder
的默认配置, 默认为 TCP.<br />- H2: SslProvider 将根据
OpenSsl.isAlpnSupported()、SslProvider.HTTP2_CIPHERS、ALPN 支持、HTTP/1.1 和 HTTP/2
支持进行设置<br />- TCP: SslProvider 将根据 OpenSsl.isAvailable() 设置<br />- NONE:
不会有默认配置 |
@@ -300,28 +351,33 @@ Netty HttpClient 代理的相关配置:
- `shenyu.file` 配置
-文件过滤器的相关配置。
+文件过滤器的相关配置
| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
| :------ | :------ | :----: | :------: | :------------------- |
| enabled | Boolean | false | 否 | 是否开启文件大小过滤 |
-| maxSize | Integer | 10 | No | 上传文件最大值 ,(单位:MB) |
+| maxSize | Integer | 10 | 否 | 上传文件最大值 ,(单位:MB) |
- `shenyu.cross` 配置
-跨域相关配置。
-
-| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
-| :------ | :------ | :----: | :------: | :--------------- |
-| enabled | Boolean | false | 否 | 是否支持跨域请求 |
-| allowedHeaders | String | x-requested-with, authorization, Content-Type,
Authorization, credential, X-XSRF-TOKEN, token, username, client | No |
允许的Header头,多个请用 ","
分割。新的"allowedHeaders"会在默认值基础上,去除重复的追加到"Access-Control-Allow-Headers"。 |
-| allowedMethods | String | "*" | No | 允许的方法 |
-| allowedAnyOrigin | Boolean | false | No |
是否允许任意Origin,为true时直接将`Access-Control-Allow-Origin`设置值与Origin相同,即`request.getHeaders().getOrigin()`,同时丢弃`allowedOrigin`配置
|
-| allowedOrigin | AllowedOriginConfig | - | No |
配置`domain`如apache.org,域名`prefixes`如a,b及`spacer`如".",或直接使用`origins`配置如c.apche.org,http://d.apache.org,
如果`Origin`为http://a.apache.org或http://b.apache.org或http://c.apache.org或http://d.apache.org时`Access-Control-Allow-Origin`设置值与`Origin`相同,即`request.getHeaders().getOrigin()`
|
-| allowedExpose | String | "" | No | 允许的Expose |
-| maxAge | String | "18000" | No | 最大年龄 (ms) |
-| allowCredentials | Boolean | true | No | 允许认证 |
+跨域相关配置
+
+| 名称 | | 类型 | 默认值 | 是否必填 | 说明 |
+| :------ | :------ | :----: | :------: | :--------------- | :--------------: |
+| enabled | | Boolean | false | 否 | 是否支持跨域请求 |
+| allowedHeaders | | String | x-requested-with, authorization, Content-Type,
Authorization, credential, X-XSRF-TOKEN, token, username, client | 否 |
允许的Header头,多个请用 ","
分割。新的"allowedHeaders"会在默认值基础上,去除重复的追加到"Access-Control-Allow-Headers"。 |
+| allowedMethods | | String | "*" | 否 | 允许的方法 |
+| allowedAnyOrigin | | Boolean | false | 否 |
是否允许任意Origin,为true时直接将`Access-Control-Allow-Origin`设置值与Origin相同,即`request.getHeaders().getOrigin()`,同时丢弃`allowedOrigin`配置
|
+| allowedOrigin | | AllowedOriginConfig | - | 否 | 设置允许的请求来源 |
+| | spacer | String | "." | 否 | 设置允许访问的子域名,需要搭配 domain、prefixes一起使用 |
+| | domain | String | 无 | 否 | 设置允许访问的子域名,需要搭配 domain、prefixes一起使用 |
+| | prefixes | Set | 无 | 否 | 设置允许访问的子域名,需要搭配 domain、prefixes一起使用 |
+| | origins | Set | null | 否 | 设置允许访问的域名,可单独使用 |
+| | originRegex | String | 无 | 否 | 设置允许正则匹配的域名访问,可单独使用 |
+| allowedExpose | | String | "" | 否 | 允许的Expose |
+| maxAge | | String | "18000" | 否 | 最大年龄 (ms) |
+| allowCredentials | | Boolean | true | 否 | 允许认证 |
- `shenyu.exclude` 配置
@@ -333,17 +389,55 @@ Netty HttpClient 代理的相关配置:
| enabled | Boolean | false | 否 | 是否拒绝指定请求经过网关 |
| paths | Array | 无 | 是 | 匹配该列表的请求不经过网关(支持路径匹配) |
+- `shenyu.fallback` 配置
+
+熔断响应的相关配置
+
+| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
+| :------ | :------ | :----: | :------: | :----------------- |
+| enabled | Boolean | false | 否 | 是否开启熔断响应 |
+| paths | Array | 无 | 是 | 服务熔断请求的地址 |
+
+- `shenyu.health` 配置
+
+服务健康状态的相关配置
+
+| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
+| :------ | :------ |:----------------------------------------:| :------: |
:------------------- |
+| enabled | Boolean | false | 否 |
是否开启健康检测 |
+| paths | Array | `"/actuator/health"` 、`"/health_check"` | 否 |
设置服务健康监测路径 |
+
+- `shenyu.local` 配置
+
+本地转发相关配置
+
+| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
+| :-------- | :------ | :----: | :------: | :---------------------------------
|
+| enabled | Boolean | false | 否 | 是否开启本地转发 |
+| sha512Key | String | 无 | 是 | 秘钥,根据秘钥判断是否需要本地转发 |
+
+
+
+##### shenyu.switchConfig 配置
+
+ `ShenYu`开关配置
+
+| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
+| :---- | :------ | :----: | :------: |
:------------------------------------------------- |
+| local | Boolean | true | 否 | 是否开启本地模式,如果开启,本地操作数据,默认开启 |
+
##### shenyu.sync 配置
-网关和`Admin`端使用数据同步的相关配置。
+网关和`Admin`端使用数据同步的相关配置
使用`websocket`进行数据同步的属性配置如下:
-| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
-| :--- | :----- | :----: | :------: |
:------------------------------------------------- |
-| urls | String | 无 | 是 | `Admin`的websocket服务地址,多个地址用 `,` 分开 。 |
+| 名称 | 类型 | 默认值 | 是否必填 | 说明
|
+| :---------- | :----- | :----: | :------: |
:------------------------------------------------- |
+| urls | String | 无 | 是 | `Admin`的websocket服务地址,多个地址用 `,` 分开
。 |
+| allowOrigin | String | 无 | 否 | 设置允许的 `origins`, 多个参数以`;`分隔
|
@@ -367,23 +461,18 @@ Netty HttpClient 代理的相关配置:
使用`nacos`进行数据同步的属性配置如下:
-| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
-| :-------- | :----- | :----: | :------: | :---------------- |
-| url | String | 无 | 是 | `nacos`连接地址 |
-| namespace | String | 无 | 是 | 命名空间 |
-| username | String | 无 | 否 | 用户名 |
-| password | String | 无 | 否 | 密码 |
-| acm | | | 否 | 阿里云ACM服务配置 |
-
-- `acm`配置
-
-| 名称 | 类型 | 默认值 | 是否必填 | 说明 |
-| :-------- | :------ | :----: | :------: | :---------- |
-| enabled | boolean | false | 否 | 是否启用 |
-| endpoint | String | 无 | 是 | ACM服务地址 |
-| namespace | String | 无 | 否 | namespace |
-| accessKey | String | 无 | 否 | accessKey |
-| secretKey | String | 无 | 否 | secretKey |
+| 名称 | | 类型 | 默认值 | 是否必填 | 说明 |
+| :-------- | --------- | :------ | :----: | :------: | :---------------- |
+| url | | String | 无 | 是 | `nacos`连接地址 |
+| namespace | | String | 无 | 是 | 命名空间 |
+| username | | String | 无 | 否 | 用户名 |
+| password | | String | 无 | 否 | 密码 |
+| acm | | Object | - | 否 | 阿里云ACM服务配置 |
+| | enabled | boolean | false | 否 | 是否启用 |
+| | endpoint | String | 无 | 是 | ACM服务地址 |
+| | namespace | String | 无 | 否 | namespace |
+| | accessKey | String | 无 | 否 | accessKey |
+| | secretKey | String | 无 | 否 | secretKey |
@@ -404,47 +493,86 @@ Netty HttpClient 代理的相关配置:
| watchDelay | int | 无 | 是 | 同步间隔(毫秒)
|
-##### shenyu.extPlugin config
+
+##### shenyu.extPlugin 配置
Apache ShenYu对于动态加载自定义插件的配置
-|Name | Type | Default | Required | Description
|
+|名称 | 类型 | 默认值 | 是否必填 | 说明 |
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | true | No | 是否开启动态加载自定义插件,默认开启 |
-| path | String | | False | 动态加载自定义插件的路径,如果没配,默认为相对于当前网关路径下的
:/ext/lib,用户也可以使用-Dplugin-ext指定 |
-| threads | Integer | 1 | False | 动态加载自定义插件的线程数 |
-| scheduleTime | Integer | 300 | False | 动态加载自定义插件的间隔时间 ,单元:秒|
-| scheduleDelay | Integer | 30 | False | 网关启动多久后去动态加载,单元:秒|
+| enabled | Boolean | true | 否 | 是否开启动态加载自定义插件,默认开启 |
+| path | String | | 否 | 动态加载自定义插件的路径,如果没配,默认为相对于当前网关路径下的
:/ext/lib,用户也可以使用-Dplugin-ext指定 |
+| threads | Integer | 1 | 否 | 动态加载自定义插件的线程数 |
+| scheduleTime | Integer | 300 | 否 | 动态加载自定义插件的间隔时间 ,单元:秒|
+| scheduleDelay | Integer | 30 | 否 | 网关启动多久后去动态加载,单元:秒|
+
-##### shenyu.scheduler config
+
+##### shenyu.scheduler 配置
Apache ShenYu 调度线程模型配置
-|Name | Type | Default | Required | Description
|
+|名称 | 类型 | 默认值 | 是否必填 | 说明 |
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | false | No | 是否开启使用调度线程 |
-| type | String | fixed | False | 调度线程池类型,默认为fixed,不配置或者其他则为弹性线程池|
-| threads | Integer | Math.max((Runtime.getRuntime().availableProcessors()
<< 1) + 1, 16) | False | 固定线程池类型时候的线程数量 |
+| enabled | Boolean | false | 否 | 是否开启使用调度线程 |
+| type | String | fixed | 否 | 调度线程池类型,默认为fixed,不配置或者其他则为弹性线程池|
+| threads | Integer | Math.max((Runtime.getRuntime().availableProcessors()
<< 1) + 1, 16) | 否 | 固定线程池类型时候的线程数量 |
+
-##### shenyu.upstreamCheck config
+##### shenyu.upstreamCheck 配置
-Apache ShenYu动态检测upstream的配置
+Apache ShenYu 动态检测upstream的配置
-|Name | Type | Default | Required | Description
|
+|名称 | 类型 | 默认值 | 是否必填 | 说明 |
|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| enabled | Boolean | false | No | 是否检测 |
-| timeout | Integer | 3000 | False | 超时配置 (ms) |
-| healthyThreshold | Integer | 1 | False | 健康因子 |
-| unhealthyThreshold | Integer | 1 | False | 不健康因子 |
-| interval | Integer | 5000 | False | 检测的调度间隔时间|
-| printEnabled | Boolean | true | No | 是否打印日志 |
-| printInterval | Integer | 60000 | False | 打印日志的间隔调度时间 |
+| enabled | Boolean | false | 否 | 是否检测 |
+| timeout | Integer | 3000 | 否 | 超时配置 (ms) |
+| healthyThreshold | Integer | 1 | 否 | 健康因子 |
+| unhealthyThreshold | Integer | 1 | 否 | 不健康因子 |
+| interval | Integer | 5000 | 否 | 检测的调度间隔时间|
+| printEnabled | Boolean | true | 否 | 是否打印日志 |
+| printInterval | Integer | 60000 | 否 | 打印日志的间隔调度时间 |
-##### shenyu.switchConfig config
-Apache ShenYu开关配置
-|Name | Type | Default | Required | Description
|
-|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|
-| local | Boolean | true | No | 是否开启本地模式,如果开启,本地操作数据,默认开启 |
+##### shenyu.ribbon 配置
+
+Apache ShenYu 轮询间隔配置
+
+|名称 | 类型 | 默认值 | 是否必填 | 说明 |
+| :------------------------ | :------ | :-----: | :------: |
:----------------------------------------------------------- |
+| serverListRefreshInterval | Integer | 10000 | 否 |
调整刷新时间间隔参数,参考`com.netflix.client.config.CommonClientConfigKey#ServerListRefreshInterval`
|
+
+
+
+##### shenyu.metrics 配置
+
+Apache ShenYu Metrics 配置,网关用来监控自身运行状态
+
+|名称 | | 类型 | 默认值 | 是否必填 | 说明 |
+|:------------------------ |:----- |:-------:
|:-------:|:----------------------------|------------------------- |
+| enabled | | Boolean | false | 否 | 是否开启metrics,true 表示开启 |
+| name | | String | 无 | 否 | 名称 |
+| host | | String | 无 | 否 | 网关服务对采集服务暴露的ip |
+| port | | Integer | 无 | 否 | 网关服务对采集服务暴露的端口 |
+| jmxConfig | | String | 无 | 否 | jmx配置 |
+| props | | - | | 否 | 属性值 |
+| | jvm_enabled | Boolean | 无 | 否 | 开启jvm的监控指标 |
+
+
+
+##### shenyu.sharedPool 配置
+
+ Apache ShenYu 共享线程池配置
+
+|名称 | 类型 | 默认值 | 是否必填 | 说明 |
+| :----------------- | ------- |
:----------------------------------------------------- | :------: |
:-----------------------------------: |
+| enabled | Boolean | false
| 否 | 是否开启共享线程池 |
+| prefix | String | "shenyu-shared"
| 否 | 线程池名称前缀 |
+| corePoolSize | Integer | 200
| 否 | 线程池核心线程数 |
+| maximumPoolSize | Integer | Integer.MAX_VALUE
| 否 | 线程池最大线程数 |
+| keepAliveTime | Long | 60000L
| 否 | 多余的空闲线程keepAlive时间,单位毫秒 |
+| maxWorkQueueMemory | Long | 当前JVM最大可用内存的80% | 否 |
最大使用内存,单位字节 |
+| maxFreeMemory | Integer | 无
| 否 | 最大剩余内存,单位字节 |
+