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 1bba0f29f0 Discovery use (#987)
1bba0f29f0 is described below
commit 1bba0f29f0e8cb1422eeffe7a09e894239018399
Author: 杨文杰 <[email protected]>
AuthorDate: Sat Dec 23 15:38:30 2023 +0800
Discovery use (#987)
* add plugin jar
* discovery-mode
* discovery-mode
* fix ci
* discovery guid
* discovery guid
* discovery guid
* change file path
---
docs/plugin-center/discovery/discovery-mode.md | 156 ---------
.../discovery/_category_.json | 2 +-
docs/user-guide/discovery/discovery-mode.md | 365 +++++++++++++++++++++
.../plugin-center/discovery/discovery-mode.md | 151 ---------
.../discovery/_category_.json | 2 +-
.../current/user-guide/discovery/discovery-mode.md | 363 ++++++++++++++++++++
.../plugin/discovery/change-weight-status.png | Bin 0 -> 77026 bytes
.../plugin/discovery/config_local_selector.png | Bin 0 -> 57717 bytes
.../plugin/discovery/config_local_selector_2.png | Bin 0 -> 46513 bytes
.../plugin/discovery/config_local_selector_3.png | Bin 0 -> 44798 bytes
.../discovery/divide-etcd-discovery-success.png | Bin 0 -> 90344 bytes
.../discovery/divide-eureka-discovery-success.png | Bin 0 -> 94309 bytes
.../discovery/divide-local-discovery-success.png | Bin 0 -> 53411 bytes
.../discovery/divide-nacos-discovery-success.png | Bin 0 -> 90173 bytes
.../divide-zookeeper-discovery-success.png | Bin 0 -> 153673 bytes
.../divide-zookeeper-discovery-success_2.png | Bin 0 -> 91680 bytes
16 files changed, 730 insertions(+), 309 deletions(-)
diff --git a/docs/plugin-center/discovery/discovery-mode.md
b/docs/plugin-center/discovery/discovery-mode.md
deleted file mode 100644
index 54f74c8584..0000000000
--- a/docs/plugin-center/discovery/discovery-mode.md
+++ /dev/null
@@ -1,156 +0,0 @@
----
-title: Discovery
-keywords: [ "Discovery" ]
-description: Discovery Modules
----
-
-# 1. Overview
-
-## 1.1 Module Name
-
-Discovery
-
-## 1.2 Design
-
-Design drawing
-
-
-DataBase Design
-
-
-## 1.3 Notes
-
-
-The 'Discovery' gateway admin service actively listens to register to the
gateway service. The shenyu gateway has the ability to actively discover the
changes of the proxy service list
-'Discovery' can be at the selector level or the plugin level.
-The 'Discovery' plugin is currently introduced as a TCP plugin.
-
-### 1.3.1 Listener mode
-
-LOCAL , ZOOKEEPER , NACOS(To be supported) , ERURKA(To be supported) ....
-
-LOCAL mode: relies heavily on manually maintaining the upstream list to push
to the gateway
-
-ZOOKEEPER mode: Listen for temporary node changes in the specified node in zk
for data
-
-### 1.3.2 Scope of action
-
-Plugin-level: THIS APPLIES TO THE entire PLUGIN. All CHOICES MADE BY the
PLUGIN will default to the current listening mode
-Selector level: This applies to the current selector. There are different
selectors that use different listening modes under the current plugin
-
-# 2. How to use
-
-## 2.1 Plug-in level Configuration
-
-1. In the plugin that supports the Discovery module click 'Discovery
configuration' to select the listening mode for the response
- Take Zookeeper as an example
-
- 
-
-2. In the selector, click 'Add' on the new selector page and click
'DiscoveryConfig' to find the Type type to force the plugin-level listener that
you just configured
- In this case, we need to listen to the 'ListenerNode' : /shenyu/discovery
as an example
-
- 
-
- Note: In this Handler configuration, shenyu specifies that the upstream
registration data is sent in the following json form
-
- ```json
- {
- "url": "127.0.0.1::6379", // upstream's url
- "protocol": "tcp", // upstream's protocol
- "status": 0, // upstream's (0, healthy, 1 unhealthy)
- "weight": 10 // Used when calculating load balancing
- }
- ```
-
- You can alias the handler if your service alias is different from the json
format defined by shenyu
- In the above image, I need to change the status to healthy. The other is to
save the original json-key form
-
-3. See plugin for details on how to configure selector properties
-
-## 2.2 Selector level configuration
-
-Similar to plug-in level configuration. Combine the '1', '2' steps above
-
-
-Note: When using selector levels. It has to be reconfigured each time
-
-If you choose the LOCAL mode, you don't need to log into a registry and
manually maintain the upstream list
-
-
-
-# 3. Configuration
-
-## 3.1 Registration Information Configuration
-
-### 3.1.1 Basic Configuration
-
-
-
-- Type registered Type [LOCAL | ZOOKEEPER]
-- ListenerNode registers listeners like '/shenyu/discovery'
-- Handler handles aliasing of upstream registration information
-- ServerList registry link url
-
-
-### 3.1.2 Detailed explanation of data
-
-- The `upstream` registration data is :
-
-```json
-{
- "protocol": "tcp",
- "url": "127.0.0.1:6379",
- "status": 0,
- "weight": 1,
- "props": "{}"
-}
-```
-
-- If the registered data format is different from the default json format, you
can set an alias in the "Conversion process":
-
-```json
-{
- "${yourProtocol}": "tcp",
- "${yourUrl}": "127.0.0.1:6379",
- "${yourStatus}": 1,
- "${yourWeight}": 1,
- "${yourProps}": "{}"
-}
-```
-
-## 3.2 Configuration in different modes
-
-### 3.1 LOCAL
-
-Only the selector level is supported in LOCAL mode
-No need to specify a link registry configuration just manually maintain the
upstream list
-
-
-
-### 3.2 ZOOKEEPER
-
-ZOOKEEPER mode supports both the plugin level and the selector level
-
-
-SEE `shenyu-discovery-zookeeper#ZookeeperDiscoveryService#init`
-
-```json
-{
- "baseSleepTimeMilliseconds": "1000",
- "maxRetries": "3",
- "maxSleepTimeMilliseconds": "1000",
- "connectionTimeoutMilliseconds": "1000",
- "sessionTimeoutMilliseconds": "1000",
- "namespace": "",
- "digest": null
-}
-```
-
-- You can search for the dictionary name as "zookeeper" in `shenyu-admin` -->
BasicConfig --> Dictionary,
- and modify the dictionary value corresponding to the default properties
- ( __Note__: The dictionary type and dictionary name cannot be modified):
-
-
-
-
diff --git a/docs/plugin-center/discovery/_category_.json
b/docs/user-guide/discovery/_category_.json
similarity index 63%
rename from docs/plugin-center/discovery/_category_.json
rename to docs/user-guide/discovery/_category_.json
index 7ae1711b97..78b365b8a3 100644
--- a/docs/plugin-center/discovery/_category_.json
+++ b/docs/user-guide/discovery/_category_.json
@@ -1,4 +1,4 @@
{
"label": "discovery",
- "position": 9
+ "position": 4
}
diff --git a/docs/user-guide/discovery/discovery-mode.md
b/docs/user-guide/discovery/discovery-mode.md
new file mode 100644
index 0000000000..9064cac76a
--- /dev/null
+++ b/docs/user-guide/discovery/discovery-mode.md
@@ -0,0 +1,365 @@
+---
+title: Discovery
+keywords: [ "Discovery" ]
+description: Discovery Modules
+---
+
+# 1. Overview
+
+## 1.1 Module Name
+
+Discovery
+
+## 1.2 Design
+
+Design drawing
+
+
+DataBase Design
+
+
+## 1.3 Notes
+
+
+The 'Discovery' gateway admin service actively listens to register to the
gateway service. The shenyu gateway has the ability to actively discover the
changes of the proxy service list
+'Discovery' can be at the selector level or the plugin level.
+The 'Discovery' plugin is currently introduced as a TCP ,Divide,Websocket,Grpc
Plugin.
+
+### 1.3.1 Listener mode
+
+LOCAL , ZOOKEEPER , NACOS(To be supported) , ERURKA(To be supported) ....
+
+LOCAL mode: relies heavily on manually maintaining the upstream list to push
to the gateway
+
+ZOOKEEPER mode: Listen for temporary node changes in the specified node in zk
for data
+
+### 1.3.2 Scope of action
+
+Plugin-level: THIS APPLIES TO THE entire PLUGIN. All CHOICES MADE BY the
PLUGIN will default to the current listening mode
+Selector level: This applies to the current selector. There are different
selectors that use different listening modes under the current plugin
+
+# 2. How to use
+
+## 2.1 Plug-in level Configuration
+
+1. In the plugin that supports the Discovery module click 'Discovery
configuration' to select the listening mode for the response
+ Take Zookeeper as an example
+
+ 
+
+2. In the selector, click 'Add' on the new selector page and click
'DiscoveryConfig' to find the Type type to force the plugin-level listener that
you just configured
+ In this case, we need to listen to the 'ListenerNode' : /shenyu/discovery
as an example
+
+ 
+
+ Note: In this Handler configuration, shenyu specifies that the upstream
registration data is sent in the following json form
+
+ ```json
+ {
+ "url": "127.0.0.1::6379", // upstream's url
+ "protocol": "tcp", // upstream's protocol
+ "status": 0, // upstream's (0, healthy, 1 unhealthy)
+ "weight": 10 // Used when calculating load balancing
+ }
+ ```
+
+ You can alias the handler if your service alias is different from the json
format defined by shenyu
+ In the above image, I need to change the status to healthy. The other is to
save the original json-key form
+
+3. See plugin for details on how to configure selector properties
+
+## 2.2 Selector level configuration
+
+Similar to plug-in level configuration. Combine the '1', '2' steps above
+
+
+Note: When using selector levels. It has to be reconfigured each time
+
+If you choose the LOCAL mode, you don't need to log into a registry and
manually maintain the upstream list
+
+
+
+# 3. Configuration
+
+## 3.1 Registration Information Configuration
+
+### 3.1.1 Basic Configuration
+
+
+
+- Type registered Type [LOCAL | ZOOKEEPER]
+- ListenerNode registers listeners like '/shenyu/discovery'
+- Handler handles aliasing of upstream registration information
+- ServerList registry link url
+
+
+### 3.1.2 Detailed explanation of data
+
+- The `upstream` registration data is :
+
+```json
+{
+ "protocol": "tcp",
+ "url": "127.0.0.1:6379",
+ "status": 0,
+ "weight": 1,
+ "props": "{}"
+}
+```
+
+- If the registered data format is different from the default json format, you
can set an alias in the "Conversion process":
+
+```json
+{
+ "${yourProtocol}": "tcp",
+ "${yourUrl}": "127.0.0.1:6379",
+ "${yourStatus}": 1,
+ "${yourWeight}": 1,
+ "${yourProps}": "{}"
+}
+```
+
+## 3.2 Configuration in different modes
+
+### 3.1 LOCAL
+
+Only the selector level is supported in LOCAL mode
+No need to specify a link registry configuration just manually maintain the
upstream list
+
+
+
+### 3.2 ZOOKEEPER
+
+ZOOKEEPER mode supports both the plugin level and the selector level
+
+
+SEE `shenyu-discovery-zookeeper#ZookeeperDiscoveryService#init`
+
+```json
+{
+ "baseSleepTimeMilliseconds": "1000",
+ "maxRetries": "3",
+ "maxSleepTimeMilliseconds": "1000",
+ "connectionTimeoutMilliseconds": "1000",
+ "sessionTimeoutMilliseconds": "1000",
+ "namespace": "",
+ "digest": null
+}
+```
+
+- You can search for the dictionary name as "zookeeper" in `shenyu-admin` -->
BasicConfig --> Dictionary,
+ and modify the dictionary value corresponding to the default properties
+ ( __Note__: The dictionary type and dictionary name cannot be modified):
+
+
+
+
+# 4.Using with Shenyu-client
+
+
+## 4.1 Overview
+
+To use with shenyu-client, you need to depend on middleware such as zookeeper,
nacos, etcd, eureka for automatic sensing of online and offline status.
+For local mode, you need to manually maintain the upstream list.
+
+## 4.2 Examples
+
+For details on using shenyu-client, see the shenyu-client module.
+
+
+### 4.2.1 Local Example
+
+Local mode does not require configuration of the registry.
+
+1.If you choose to use shenyu-client to automatically register in Local mode
and register the current list:
+
+
+
+2. If you do not use shenyu-client, you can configure it manually:
+
+
+
+Manually configure Selector
+
+Manually configure Rule
+
+
+Test connection:
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+
+### 4.2.2 Zookeeper Example
+
+Take Divide as an example.
+
+Add dependencies:
+
+```xml
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-zookeeper</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+```yaml
+shenyu:
+ discovery:
+ enable: true
+ type: zookeeper
+ serverList: ${your.zookeeper.ip}:{your.zookeeper.port}
+ registerPath: /shenyu/discovery/demo_http_common
+ props:
+ baseSleepTimeMilliseconds: 1000
+ maxRetries: 4
+ maxSleepTimeMilliseconds: 5000
+ connectionTimeoutMilliseconds: 60000
+ sessionTimeoutMilliseconds: 8
+```
+
+Start the shenyu-examples-http project.
+
+The above indicates successful registration.
+
+
+
+
+Test connection:
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.3 Etcd Example
+
+Add dependencies:
+
+```xml
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-etcd</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+```yaml
+shenyu:
+ discovery:
+ enable: true
+ type: etcd
+ serverList: http://${your.etcd.host}:${your.etcd.port}
+ registerPath: shenyu_discovery_demo_http_common
+ props:
+ etcdTimeout: 3000
+ etcdTTL: 5
+```
+
+Start shenyu-examples-http.
+
+The above indicates successful registration.
+
+
+Test connection:
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.4 Eureka Example
+
+Add dependencies:
+
+```xml
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-eureka</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+```yaml
+shenyu:
+ discovery:
+ enable: true
+ type: eureka
+ serverList: http://${your.eureka.host}:${your.eureka.port}/eureka
+ registerPath: shenyu_discovery_demo_http_common
+ props:
+ eurekaClientRefreshInterval: 10
+ eurekaClientRegistryFetchIntervalSeconds: 10
+```
+
+The above indicates successful registration.
+
+
+The above indicates successful registration.
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.4 Nacos Example
+
+```xml
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-nacos</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+The above indicates successful registration.
+
+
+The above indicates successful registration.
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+
+## 4.3 Changing Weight and Status
+
+status : 0 Healthy , 1 Unhealthy
+
+weight : Weight. For details, see the weight algorithm in the
shenyu-loadbalancer module.
+
+
+
+## 4.4 Test report
+
+[Test Report](https://www.yuque.com/eureca/pgotw1/hkqkk5laubspgwl3#UojLR)
+
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/discovery-mode.md
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/discovery-mode.md
deleted file mode 100644
index a4f846d051..0000000000
---
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/discovery-mode.md
+++ /dev/null
@@ -1,151 +0,0 @@
----
-title: Discovery模块
-keywords: [ "Discovery" ]
-description: Discovery模块
----
-
-# 1. 概述
-
-## 1.1 模块名称
-
-Discovery
-
-## 1.2 设计
-
-设计图
-
-
-数据库设计
-
-
-## 1.3 说明
-
-`Discovery`网关admin服务主动监听 注册到网管服务. 使得shenyu网关具备主动发现被代理服务列表的变化
-`Discovery` 可以针对 选择器级别, 也可以针对 插件级别.
-目前 引入 `Discovery` 插件为 TCP 插件.
-
-### 1.3.1 监听模式
-
-LOCAL , ZOOKEEPER , NACOS(待支持) , ERURKA(待支持) ....
-
-LOCAL 模式 : 主要依靠手动维护 upstream 列表 推送到网关
-
-ZOOKEEPER 模式 : 监听 zk 下指定节点下的 临时节点变化来获取数据
-
-### 1.3.2 作用范围
-
-插件级: 作用于整个插件,该插件下所以的选择都会默认使用当前监听模式
-选择器级别: 作用于当前选择器,当前插件下有不同选择器使用不同的监听模式
-
-# 2. 使用
-
-## 2.1 插件级别配置
-
-1. 在支持Discovery模块的插件中 点击 `Discovery configuration` 选择响应的监听模式
- 下图以`Zookeeper`为例
-
- 
-
-2. 在选择器中使用 点击 `Add` 在新增选择器页面点击 `DiscoveryConfig` 发现Type 类型强制选择刚才配置的插件级监听模块
- 此时 收入需要监听的 `ListenerNode` 我们以 : /shenyu/discovery 为例
-
- 
-
- 注意: 这里的 Handler 配置, shenyu 规定的upstream 注册数据是以下 json 形式发送
-
- ```json
- {
- "url": "127.0.0.1::6379", // upstream 的 url
- "protocol": "tcp", // upstream 的 通信协议
- "status": 0, // upstream 节点的状态 (0, healthy, 1 unhealthy)
- "weight": 10 // 计算负载均衡时使用
- }
- ```
-
- 如果 你的服务 别名和shenyu 定义的 json 格式不同时候 可以在 handler 起别名
- 如上图 我需要吧status 改为 healthy. 其他为改 保存 原有 json-key 的形式
-
-3. 进行后续selector属性配置 详情见具体plugin
-
-## 2.2 选择器级别配置
-
-类似于插件级别配置. 把 上述的 `1`,`2` 步骤合并在一起
-
-
-注意: 使用选择器级别时候. 每次都必须重新配置
-
-若选择了 LOCAL 模式 则无需接入注册中心, 手动维护upstream列表
-
-
-
-# 3. 配置
-
-## 3.1 注册信息配置
-
-### 3.1.1 基本配置
-
-
-
-- Type 注册类型 [LOCAL|ZOOKEEPER]
-- ListenerNode 注册的监听节点 如`/shenyu/discovery`
-- Handler 处理 upstream 注册信息的别名问题
-- ServerList 注册中心链接url
-
-
-### 3.1.2 数据详解
-
-- upstream 注册数据为:
-
-```json
-{
- "protocol": "tcp",
- "url": "127.0.0.1:6379",
- "status": 0,
- "weight": 1,
- "props": "{}"
-}
-```
-
-- 若注册的数据与默认的json格式不同时,可以在“转换处理”中设置别名:
-
-```json
-{
- "${yourProtocol}": "tcp",
- "${yourUrl}": "127.0.0.1:6379",
- "${yourStatus}": 1,
- "${yourWeight}": 1,
- "${yourProps}": "{}"
-}
-```
-
-## 3.2 不同模式下的配置
-
-### 3.1 LOCAL
-
-LOCAL模式下 只支持 选择器级别
-无需指定链接 注册中心配置 只需手动维护 upstream 列表
-
-
-### 3.2 ZOOKEEPER
-
-ZOOKEEPER模式下 支持 插件级别 和 选择器级别
-
-详情见 `shenyu-discovery-zookeeper#ZookeeperDiscoveryService#init`
-
-```json
-{
- "baseSleepTimeMilliseconds": "1000",
- "maxRetries": "3",
- "maxSleepTimeMilliseconds": "1000",
- "connectionTimeoutMilliseconds": "1000",
- "sessionTimeoutMilliseconds": "1000",
- "namespace": "",
- "digest": null
-}
-```
-
-- 用户可以在`shenyu-admin` --> 基础配置 --> 字典管理 中,搜索字典名称为“zookeeper”,对默认属性对应的字典值进行修改编辑
- (__注意__:不可修改字典类型和字典名称):
-
-
-
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/_category_.json
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/discovery/_category_.json
similarity index 65%
rename from
i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/_category_.json
rename to
i18n/zh/docusaurus-plugin-content-docs/current/user-guide/discovery/_category_.json
index 76bfa9d889..66f64292a8 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/_category_.json
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/discovery/_category_.json
@@ -1,4 +1,4 @@
{
"label": "服务发现",
- "position": 9
+ "position": 4
}
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/discovery/discovery-mode.md
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/discovery/discovery-mode.md
new file mode 100644
index 0000000000..735c2b7143
--- /dev/null
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/user-guide/discovery/discovery-mode.md
@@ -0,0 +1,363 @@
+---
+title: Discovery模块
+keywords: [ "Discovery" ]
+description: Discovery模块
+---
+
+# 1. 概述
+
+## 1.1 模块名称
+
+Discovery
+
+## 1.2 设计
+
+设计图
+
+
+数据库设计
+
+
+## 1.3 说明
+
+`Discovery`网关admin服务主动监听 注册到网管服务. 使得shenyu网关具备主动发现被代理服务列表的变化
+`Discovery` 可以针对 选择器级别, 也可以针对 插件级别.
+目前 引入 `Discovery` 插件为 TCP 插件.
+
+### 1.3.1 监听模式
+
+LOCAL , ZOOKEEPER , NACOS , ERURKA , ETCD
+
+LOCAL 模式 : 主要依靠手动维护 upstream 列表 推送到网管
+
+ZOOKEEPER 模式 : 监听 zk 下指定节点下的 临时节点变化来获取数据
+
+### 1.3.2 作用范围
+
+插件级: 作用于整个插件,该插件下所以的选择都会默认使用当前监听模式
+选择器级别: 作用于当前选择器,当前插件下有不同选择器使用不同的监听模式
+
+# 2. 使用
+
+## 2.1 插件级别配置
+
+1. 在支持Discovery模块的插件中 点击 `Discovery configuration` 选择响应的监听模式
+ 下图以`Zookeeper`为例
+
+ 
+
+2. 在选择器中使用 点击 `Add` 在新增选择器页面点击 `DiscoveryConfig` 发现Type 类型强制选择刚才配置的插件级监听模块
+ 此时 收入需要监听的 `ListenerNode` 我们以 : /shenyu/discovery 为例
+
+ 
+
+ 注意: 这里的 Handler 配置, shenyu 规定的upstream 注册数据是以下 json 形式发送
+
+ ```json
+ {
+ "url": "127.0.0.1::6379", // upstream 的 url
+ "protocol": "tcp", // upstream 的 通信协议
+ "status": 0, // upstream 节点的状态 (0, healthy, 1 unhealthy)
+ "weight": 10 // 计算负载均衡时使用
+ }
+ ```
+
+ 如果 你的服务 别名和shenyu 定义的 json 格式不同时候 可以在 handler 起别名
+ 如上图 我需要吧status 改为 healthy. 其他为改 保存 原有 json-key 的形式
+
+3. 进行后续selector属性配置 详情见具体plugin
+
+## 2.2 选择器级别配置
+
+类似于插件级别配置. 把 上述的 `1`,`2` 步骤合并在一起
+
+
+注意: 使用选择器级别时候. 每次都必须重新配置
+
+若选择了 LOCAL 模式 则无需接入注册中心, 手动维护upstream列表
+
+
+
+# 3. 配置
+
+## 3.1 注册信息配置
+
+### 3.1.1 基本配置
+
+
+
+- Type 注册类型 [LOCAL|ZOOKEEPER]
+- ListenerNode 注册的监听节点 如`/shenyu/discovery`
+- Handler 处理 upstream 注册信息的别名问题
+- ServerList 注册中心链接url
+
+### 3.1.2 数据详解
+
+- upstream 注册数据为:
+
+```json
+{
+ "protocol": "tcp",
+ "url": "127.0.0.1:6379",
+ "status": 0,
+ "weight": 1,
+ "props": "{}"
+}
+```
+
+- 若注册的数据与默认的json格式不同时,可以在“转换处理”中设置别名:
+
+```json
+{
+ "${yourProtocol}": "tcp",
+ "${yourUrl}": "127.0.0.1:6379",
+ "${yourStatus}": 1,
+ "${yourWeight}": 1,
+ "${yourProps}": "{}"
+}
+```
+
+## 3.2 不同模式下的配置
+
+### 3.1 LOCAL
+
+LOCAL模式下 只支持 选择器级别
+无需指定链接 注册中心配置 只需手动维护 upstream 列表
+
+
+### 3.2 ZOOKEEPER
+
+ZOOKEEPER模式下 支持 插件级别 和 选择器级别
+
+详情见 `shenyu-discovery-zookeeper#ZookeeperDiscoveryService#init`
+
+```json
+{
+ "baseSleepTimeMilliseconds": "1000",
+ "maxRetries": "3",
+ "maxSleepTimeMilliseconds": "1000",
+ "connectionTimeoutMilliseconds": "1000",
+ "sessionTimeoutMilliseconds": "1000",
+ "namespace": "",
+ "digest": null
+}
+```
+
+- 用户可以在`shenyu-admin` --> 基础配置 --> 字典管理 中,搜索字典名称为“zookeeper”,对默认属性对应的字典值进行修改编辑
+ (__注意__:不可修改字典类型和字典名称):
+
+
+
+# 4.配合 Shenyu-client 使用
+
+## 4.1 概括
+
+配合shenyu-client使用 需要依赖
+使用中间件 zookeeper, nacos , etcd, eureka 模式 依赖admin 自动感知上下线
+使用local模式 需要 手动维护 upstream列表
+
+## 4.2 示例
+
+shenyu-client 使用详情见 shenyu-client 模块
+
+### 4.2.1 Local示例
+
+Local模式 不需要配置注册中心
+
+1.如果选择使用shenyu-client自动注册为Local模式并且把当前列表注册上去
+
+
+
+2. 如果不使用shenyu-client 你可以自己手动配置
+
+
+
+手动自行添加
+
+手动配置Rule
+
+
+测试连接
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.2 Zookeeper示例
+
+以 Divide为例
+
+添加依赖
+
+```xml
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-zookeeper</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+<groupId>org.apache.shenyu</groupId>
+<artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+```yaml
+shenyu:
+ discovery:
+ enable: true
+ type: zookeeper
+ serverList: ${your.zookeeper.ip}:{your.zookeeper.port}
+ registerPath: /shenyu/discovery/demo_http_common
+ props:
+ baseSleepTimeMilliseconds: 1000
+ maxRetries: 4
+ maxSleepTimeMilliseconds: 5000
+ connectionTimeoutMilliseconds: 60000
+ sessionTimeoutMilliseconds: 8
+```
+
+启动项目 shenyu-examples-http
+
+上述说明组册成功
+
+
+
+
+测试连接
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.3 Etcd示例
+
+添加依赖
+
+```xml
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-etcd</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+<groupId>org.apache.shenyu</groupId>
+<artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+```yaml
+shenyu:
+ discovery:
+ enable: true
+ type: etcd
+ serverList: http://${your.etcd.host}:${your.etcd.port}
+ registerPath: shenyu_discovery_demo_http_common
+ props:
+ etcdTimeout: 3000
+ etcdTTL: 5
+```
+
+启动shenyu-examples-http
+
+上述说明组册成功
+
+
+测试连接
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.4 Eureka示例
+
+添加依赖
+
+```xml
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-eureka</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+<groupId>org.apache.shenyu</groupId>
+<artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+```yaml
+shenyu:
+ discovery:
+ enable: true
+ type: eureka
+ serverList: http://${your.eureka.host}:${your.eureka.port}/eureka
+ registerPath: shenyu_discovery_demo_http_common
+ props:
+ eurekaClientRefreshInterval: 10
+ eurekaClientRegistryFetchIntervalSeconds: 10
+```
+
+上述说明组册成功
+
+
+测试连接
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+### 4.2.4 Nacos示例
+
+```xml
+
+<dependency>
+ <groupId>org.apache.shenyu</groupId>
+ <artifactId>shenyu-discovery-nacos</artifactId>
+ <version>${project.version}</version>
+</dependency>
+
+<dependency>
+<groupId>org.apache.shenyu</groupId>
+<artifactId>shenyu-spring-boot-starter-client-http</artifactId>
+</dependency>
+```
+
+上述说明组册成功
+
+
+测试连接
+
+```text
+curl http://localhost:9195/http/hello
+
+hello! I'm Shenyu-Gateway System. Welcome!%
+```
+
+## 4.3 修改权重和状态
+
+status : 0 健康 , 1 不健康
+
+weight : 权重 详情见 权重算法 shenyu-loadbalancer 模块
+
+
+
+## 4.4 测试报告
+
+[测试报告](https://www.yuque.com/eureca/pgotw1/hkqkk5laubspgwl3#UojLR)
+
+
+
+
diff --git a/static/img/shenyu/plugin/discovery/change-weight-status.png
b/static/img/shenyu/plugin/discovery/change-weight-status.png
new file mode 100644
index 0000000000..a62e0e0ce8
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/change-weight-status.png differ
diff --git a/static/img/shenyu/plugin/discovery/config_local_selector.png
b/static/img/shenyu/plugin/discovery/config_local_selector.png
new file mode 100644
index 0000000000..485fda10db
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/config_local_selector.png differ
diff --git a/static/img/shenyu/plugin/discovery/config_local_selector_2.png
b/static/img/shenyu/plugin/discovery/config_local_selector_2.png
new file mode 100644
index 0000000000..3a52806486
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/config_local_selector_2.png differ
diff --git a/static/img/shenyu/plugin/discovery/config_local_selector_3.png
b/static/img/shenyu/plugin/discovery/config_local_selector_3.png
new file mode 100644
index 0000000000..59ff3314e9
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/config_local_selector_3.png differ
diff --git
a/static/img/shenyu/plugin/discovery/divide-etcd-discovery-success.png
b/static/img/shenyu/plugin/discovery/divide-etcd-discovery-success.png
new file mode 100644
index 0000000000..d528a8e822
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/divide-etcd-discovery-success.png differ
diff --git
a/static/img/shenyu/plugin/discovery/divide-eureka-discovery-success.png
b/static/img/shenyu/plugin/discovery/divide-eureka-discovery-success.png
new file mode 100644
index 0000000000..e22273732b
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/divide-eureka-discovery-success.png differ
diff --git
a/static/img/shenyu/plugin/discovery/divide-local-discovery-success.png
b/static/img/shenyu/plugin/discovery/divide-local-discovery-success.png
new file mode 100644
index 0000000000..26f7dc4578
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/divide-local-discovery-success.png differ
diff --git
a/static/img/shenyu/plugin/discovery/divide-nacos-discovery-success.png
b/static/img/shenyu/plugin/discovery/divide-nacos-discovery-success.png
new file mode 100644
index 0000000000..f327d044d7
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/divide-nacos-discovery-success.png differ
diff --git
a/static/img/shenyu/plugin/discovery/divide-zookeeper-discovery-success.png
b/static/img/shenyu/plugin/discovery/divide-zookeeper-discovery-success.png
new file mode 100644
index 0000000000..502ac6608f
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/divide-zookeeper-discovery-success.png
differ
diff --git
a/static/img/shenyu/plugin/discovery/divide-zookeeper-discovery-success_2.png
b/static/img/shenyu/plugin/discovery/divide-zookeeper-discovery-success_2.png
new file mode 100644
index 0000000000..a1d78ee0d3
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/divide-zookeeper-discovery-success_2.png
differ