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 a0fc908b41 add discovery mode doc (#942)
a0fc908b41 is described below
commit a0fc908b41ba6a9926865893e533d3f4766e11bb
Author: 杨文杰 <[email protected]>
AuthorDate: Tue Aug 1 14:33:22 2023 +0800
add discovery mode doc (#942)
* add plugin jar
* discovery-mode
* discovery-mode
* fix ci
---
docs/plugin-center/discovery/_category_.json | 4 +
docs/plugin-center/discovery/discovery-mode.md | 156 +++++++++++++++++++++
docs/plugin-center/proxy/tcp-plugin.md | 54 +------
.../plugin-center/discovery/_category_.json | 4 +
.../plugin-center/discovery/discovery-mode.md | 151 ++++++++++++++++++++
.../current/plugin-center/proxy/tcp-plugin.md | 58 +-------
.../shenyu/plugin/discovery/add_listener_node.png | Bin 0 -> 42611 bytes
.../img/shenyu/plugin/discovery/common-config.png | Bin 0 -> 27941 bytes
.../shenyu/plugin/discovery/config_zk_plugin.png | Bin 0 -> 57706 bytes
static/img/shenyu/plugin/discovery/db-design.png | Bin 0 -> 116284 bytes
.../shenyu/plugin/discovery/discovery-design.png | Bin 0 -> 341090 bytes
.../plugin/discovery/discovery-local-mode.png | Bin 0 -> 52166 bytes
.../plugin/discovery/discovery-seletor-config.png | Bin 0 -> 82971 bytes
13 files changed, 321 insertions(+), 106 deletions(-)
diff --git a/docs/plugin-center/discovery/_category_.json
b/docs/plugin-center/discovery/_category_.json
new file mode 100644
index 0000000000..7ae1711b97
--- /dev/null
+++ b/docs/plugin-center/discovery/_category_.json
@@ -0,0 +1,4 @@
+{
+ "label": "discovery",
+ "position": 9
+}
diff --git a/docs/plugin-center/discovery/discovery-mode.md
b/docs/plugin-center/discovery/discovery-mode.md
new file mode 100644
index 0000000000..54f74c8584
--- /dev/null
+++ b/docs/plugin-center/discovery/discovery-mode.md
@@ -0,0 +1,156 @@
+---
+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/proxy/tcp-plugin.md
b/docs/plugin-center/proxy/tcp-plugin.md
index 2c8c698d0d..a7b3724e3c 100644
--- a/docs/plugin-center/proxy/tcp-plugin.md
+++ b/docs/plugin-center/proxy/tcp-plugin.md
@@ -81,6 +81,8 @@ You can search for the tcp plugin in `shenyu-admin` -->
BasicConfig --> PluginHa
## 2.3 Configure service discovery
+`discovery` see [discovery-mode](../discovery/discovery-mode.md)
+
The TCP plugin supports two levels of discovery configuration: plugin-level
and selector-level:
① You can click the "Discovery Configuration" button on the page to configure
plugin-level discovery in the pop-up form.
@@ -98,58 +100,8 @@ Discovery `Zookeeper` and `Local` modes are currently
supported.
### 2.3.1 Zookeeper Mode
-- When "zookeeper" is selected as the type of discovery,
-the form displays the corresponding fields that need to be filled in:
-
-
-
-
-- The data is:
-
-```json
-{
- "protocol": "tcp",
- "url": "127.0.0.1:6379",
- "status": 1,
- "weight": 1,
- "props": "{}"
-}
-```
-
-- If the registered data is different from the default json format,
-you can set an alias in "handler":
-
-```json
-{
- "${yourProtocol}": "tcp",
- "${yourUrl}": "127.0.0.1:6379",
- "${yourStatus}": 1,
- "${yourWeight}": 1,
- "${yourProps}": "{}"
-}
-```
-
-- The discovery properties corresponding to the zookeeper mode default to:
-
-```json
-{
- "baseSleepTimeMilliseconds":"1000",
- "maxRetries":"3",
- "maxSleepTimeMilliseconds":"1000",
- "connectionTimeoutMilliseconds":"1000",
- "sessionTimeoutMilliseconds":"1000",
- "namespace":"",
- "digest":null
-}
-```
-
-See `shenyu-discovery-zookeeper#ZookeeperDiscoveryService#init` for details.
-
-- 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):
-
+- When the type of service Discovery is Zookeeper, you need to fill out the
Discovery-ZooKeeper configuration training for details
[discovery-mode](../discovery/discovery-mode.md)
- In zookeeper mode, the discovery module will automatically monitor the
user's zookeeper registration center
and automatically maintain discovery upstreams:
diff --git
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/_category_.json
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/_category_.json
new file mode 100644
index 0000000000..76bfa9d889
--- /dev/null
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/_category_.json
@@ -0,0 +1,4 @@
+{
+ "label": "服务发现",
+ "position": 9
+}
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
new file mode 100644
index 0000000000..ae91c1f87c
--- /dev/null
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/discovery/discovery-mode.md
@@ -0,0 +1,151 @@
+---
+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/proxy/tcp-plugin.md
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/tcp-plugin.md
index 7442a369b1..01483ddb25 100644
---
a/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/tcp-plugin.md
+++
b/i18n/zh/docusaurus-plugin-content-docs/current/plugin-center/proxy/tcp-plugin.md
@@ -81,6 +81,8 @@ ReactorNetty TcpServer 配置,详情见
`shenyu-protocol-tcp#TcpBootstrapServ
TCP 插件支持插件级别、选择器级别两种级别的服务发现配置:
+服务发现 详情 见 [discovery-mode](../discovery/discovery-mode.md)
+
① 用户点击页面上的“服务发现配置”按钮,便可以在弹出的表单中配置插件级别的服务发现。配置完成后,再次打开表单,可以修改或删除之前的配置。
插件级别discovery配置后,选择器的discovery设置默认与插件级别保持一致:
@@ -95,67 +97,13 @@ TCP 插件支持插件级别、选择器级别两种级别的服务发现配置
### 2.3.1 Zookeeper 模式
-- 当服务发现的类型选择zookeeper时,表单展示需要填写的对应字段:
-
-
-
-
-- 数据为:
-
-```json
-{
- "protocol": "tcp",
- "url": "127.0.0.1:6379",
- "status": 1,
- "weight": 1,
- "props": "{}"
-}
-```
-
-- 若注册的数据与默认的json格式不同时,可以在“转换处理”中设置别名:
-
-```json
-{
- "${yourProtocol}": "tcp",
- "${yourUrl}": "127.0.0.1:6379",
- "${yourStatus}": 1,
- "${yourWeight}": 1,
- "${yourProps}": "{}"
-}
-```
-
-- zookeeper模式对应的服务发现属性默认为:
-
-```json
-{
- "baseSleepTimeMilliseconds":"1000",
- "maxRetries":"3",
- "maxSleepTimeMilliseconds":"1000",
- "connectionTimeoutMilliseconds":"1000",
- "sessionTimeoutMilliseconds":"1000",
- "namespace":"",
- "digest":null
-}
-```
-
-详情见 `shenyu-discovery-zookeeper#ZookeeperDiscoveryService#init`
-
-- 用户可以在`shenyu-admin` --> 基础配置 --> 字典管理 中,搜索字典名称为“zookeeper”,对默认属性对应的字典值进行修改编辑
-(__注意__:不可修改字典类型和字典名称):
-
-
+- 当服务发现的类型选择zookeeper时,需要填写 Discovery-Zookeeper 配置 培训详情见
[discovery-mode](../discovery/discovery-mode.md)
- zookeeper模式下,discovery模块会自动监听用户的 zookeeper 注册中心,自动维护 discovery_upstream

-
-
-
-
-
-
### 2.3.2 Local 模式
- 当服务发现的类型选择local时,需要手动填写服务下游列表。如图所示,服务下游列表为可编辑表格,
diff --git a/static/img/shenyu/plugin/discovery/add_listener_node.png
b/static/img/shenyu/plugin/discovery/add_listener_node.png
new file mode 100644
index 0000000000..8381340f73
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/add_listener_node.png differ
diff --git a/static/img/shenyu/plugin/discovery/common-config.png
b/static/img/shenyu/plugin/discovery/common-config.png
new file mode 100644
index 0000000000..8fb346d16f
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/common-config.png differ
diff --git a/static/img/shenyu/plugin/discovery/config_zk_plugin.png
b/static/img/shenyu/plugin/discovery/config_zk_plugin.png
new file mode 100644
index 0000000000..8a8e2e764b
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/config_zk_plugin.png differ
diff --git a/static/img/shenyu/plugin/discovery/db-design.png
b/static/img/shenyu/plugin/discovery/db-design.png
new file mode 100644
index 0000000000..fd072edede
Binary files /dev/null and b/static/img/shenyu/plugin/discovery/db-design.png
differ
diff --git a/static/img/shenyu/plugin/discovery/discovery-design.png
b/static/img/shenyu/plugin/discovery/discovery-design.png
new file mode 100644
index 0000000000..5043750b68
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/discovery-design.png differ
diff --git a/static/img/shenyu/plugin/discovery/discovery-local-mode.png
b/static/img/shenyu/plugin/discovery/discovery-local-mode.png
new file mode 100644
index 0000000000..3dcc745afd
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/discovery-local-mode.png differ
diff --git a/static/img/shenyu/plugin/discovery/discovery-seletor-config.png
b/static/img/shenyu/plugin/discovery/discovery-seletor-config.png
new file mode 100644
index 0000000000..67d1aaae09
Binary files /dev/null and
b/static/img/shenyu/plugin/discovery/discovery-seletor-config.png differ