This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 79387c281a7 Optimize documents of shadow (#18931)
79387c281a7 is described below
commit 79387c281a79707635bfd477bc5d4825340c8546
Author: gin <[email protected]>
AuthorDate: Thu Jul 7 16:23:02 2022 +0800
Optimize documents of shadow (#18931)
---
docs/document/content/dev-manual/shadow.cn.md | 4 +-
docs/document/content/dev-manual/shadow.en.md | 18 ++--
.../builtin-algorithm/shadow.cn.md | 92 ++++++++++++-----
.../builtin-algorithm/shadow.en.md | 92 ++++++++++++-----
.../spring-boot-starter/rules/shadow.cn.md | 55 ++++++++++-
.../spring-boot-starter/rules/shadow.en.md | 52 +++++++++-
.../spring-namespace/rules/shadow.cn.md | 106 +++++++++++++-------
.../spring-namespace/rules/shadow.en.md | 109 ++++++++++++++-------
.../yaml-config/rules/shadow.cn.md | 66 ++++++++++++-
.../yaml-config/rules/shadow.en.md | 92 +++++++++++++----
10 files changed, 529 insertions(+), 157 deletions(-)
diff --git a/docs/document/content/dev-manual/shadow.cn.md
b/docs/document/content/dev-manual/shadow.cn.md
index fd2bb5911b4..5201b2e15f5 100644
--- a/docs/document/content/dev-manual/shadow.cn.md
+++ b/docs/document/content/dev-manual/shadow.cn.md
@@ -5,12 +5,12 @@ weight = 14
chapter = true
+++
-## ShadowAlgorithm
-
+## SPI 接口
| *SPI 名称* | *详细说明* |
|---------------- |------------ |
| ShadowAlgorithm | 影子库路由算法 |
+## 示例
| *已知实现类* | *详细说明* |
|-------------------------------- |----------------------- |
| ColumnValueMatchShadowAlgorithm | 基于字段值匹配影子算法 |
diff --git a/docs/document/content/dev-manual/shadow.en.md
b/docs/document/content/dev-manual/shadow.en.md
index fab0f553ea2..d3098703797 100644
--- a/docs/document/content/dev-manual/shadow.en.md
+++ b/docs/document/content/dev-manual/shadow.en.md
@@ -5,14 +5,14 @@ weight = 14
chapter = true
+++
-## ShadowAlgorithm
-
-| *SPI Name* | *Description* |
-| --------------- | ------------------------ |
+## SPI Interface
+| *SPI Name* | *Description* |
+|---------------- |------------ |
| ShadowAlgorithm | shadow routing algorithm |
-| *Implementation Class* | *Description* |
-| ------------------------------- | ----------------------------------- |
-| ColumnValueMatchShadowAlgorithm | Column value match shadow algorithm |
-| ColumnRegexMatchShadowAlgorithm | Column regex match shadow algorithm |
-| SimpleHintShadowAlgorithm | Simple hint shadow algorithm |
+## Sample
+| *Implementation Class* | *Description* |
+|-------------------------------- |----------------------- |
+| ColumnValueMatchShadowAlgorithm | Match shadow algorithms based on field
values |
+| ColumnRegexMatchShadowAlgorithm | Regular matching shadow algorithm based on
field value |
+| SimpleHintShadowAlgorithm | Simple match shadow algorithm based on Hint |
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
index 1e648590c8b..db111f56924 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.cn.md
@@ -3,42 +3,82 @@ title = "影子算法"
weight = 6
+++
-## 列影子算法
-
-### 列值匹配影子算法
+## 背景信息
+影子库功能对执行的 SQL 语句进行影子判定。影子判定支持两种类型算法,用户可根据实际业务需求选择一种或者组合使用。
+## 参数解释
+### 列影子算法
+#### 列值匹配算法
类型:VALUE_MATCH
-可配置属性:
-
-| *属性名称* | *数据类型* | *说明* |
-| -------------- | --------- | ------- |
-| column | String | 影子列 |
-| operation | String | SQL 操作类型(INSERT, UPDATE, DELETE, SELECT) |
-| value | String | 影子列匹配的值 |
-
-### 列正则表达式匹配影子算法
+| *属性名称* | *数据类型* | *说明* |
+| ----------- | ---------- | ------- |
+| column | String | 影子列 |
+| operation | String | SQL 操作类型(INSERT, UPDATE, DELETE, SELECT) |
+| value | String | 影子列匹配的值 |
+#### 列正则表达式匹配算法
类型:REGEX_MATCH
-可配置属性:
+| *属性名称* | *数据类型* | *说明* |
+| ---------- | ---------- | -------- |
+| column | String | 匹配列 |
+| operation | String | SQL 操作类型(INSERT, UPDATE, DELETE, SELECT) |
+| regex | String | 影子列匹配正则表达式 |
-| *属性名称* | *数据类型* | *说明* |
-| -------------- | --------- | ------- |
-| column | String | 匹配列 |
-| operation | String | SQL 操作类型(INSERT, UPDATE, DELETE, SELECT) |
-| regex | String | 影子列匹配正则表达式 |
+### Hint 影子算法
+#### 简单 Hint 匹配影子算法
+类型:SIMPLE_HINT
-## Hint 影子算法
+| *属性名称* | *数据类型* | *说明* |
+| ---------- | ----------- | --------- |
+| foo | String | bar |
-### 简单 Hint 匹配影子算法
+## 配置示例
+- Java API
-类型:SIMPLE_HINT
+```java
+public final class ShadowConfiguration {
+ // ...
+
+ private ShardingSphereAlgorithmConfiguration
createShadowAlgorithmConfiguration() {
+ Properties userIdInsertProps = new Properties();
+ userIdInsertProps.setProperty("operation", "insert");
+ userIdInsertProps.setProperty("column", "user_id");
+ userIdInsertProps.setProperty("value", "1");
+ return new ShardingSphereAlgorithmConfiguration("VALUE_MATCH",
userIdInsertProps));
+ }
+
+ // ...
+}
+```
-可配置属性:
+- YAML:
+```yaml
+shadowAlgorithms:
+ user-id-insert-algorithm:
+ type: VALUE_MATCH
+ props:
+ column: user_id
+ operation: insert
+ value: 1
+```
-> 至少配置一组任意的键值对。比如:foo:bar
+- Spring Boot Starter:
+```properties
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.type=VALUE_MATCH
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.props.operation=insert
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.props.column=user_id
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.props.value=1
+```
-| *属性名称* | *数据类型* | *说明* |
-| -------------- | --------- | --------- |
-| foo | String | bar |
+- Spring 命名空间:
+```xml
+<shadow:shadow-algorithm id="user-id-insert-algorithm" type="VALUE_MATCH">
+ <props>
+ <prop key="operation">insert</prop>
+ <prop key="column">user_id</prop>
+ <prop key="value">1</prop>
+ </props>
+</shadow:shadow-algorithm>
+```
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
index ff233c2d615..4b96eab9e27 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow.en.md
@@ -3,42 +3,84 @@ title = "Shadow Algorithm"
weight = 6
+++
-## Column Shadow Algorithm
+## Background
+The shadow DB feature carries out shadow measurement to SQL statements
executed. Shadow measurement supports two types of algorithms, and users can
choose one or a combination of them based on actual business needs.
-### Column Value Match Shadow Algorithm
+## Parameters
+### Column-based shadow algorithm
+#### Column value matching shadow algorithm
Type:VALUE_MATCH
-Attributes:
+| *Attribute Name* | *Data Type* | *Description* |
+| ----------- | ---------- | ------- |
+| column | String | shadow column |
+| operation | String | SQL operation type(INSERT, UPDATE, DELETE, SELECT)|
+| value | String | value matched by shadow column |
-| *Name* | *DataType* | *Description* |
-| -------------- | --------- | ------- |
-| column | String | Shadow column |
-| operation | String | SQL operation type (INSERT, UPDATE, DELETE,
SELECT) |
-| value | String | Shadow column matching value |
+#### Column-based Regex matching algorithm
+Type:REGEX_MATCH
-### Column Regex Match Shadow Algorithm
+| *Attribute Name* | *Data Type* | *Description* |
+| ---------- | ---------- | -------- |
+| column | String | match a column |
+| operation | String | SQL operation type(INSERT, UPDATE, DELETE, SELECT)|
+| regex | String | shadow column matching Regex |
-Type: REGEX_MATCH
+### Hint-based shadow algorithm
-Attributes:
+#### Simple Hint matching shadow algorithm
+Type:SIMPLE_HINT
-| *Name* | *DataType* | *Description* |
-| -------------- | --------- | ------- |
-| column | String | Shadow column |
-| operation | String | SQL operation type (insert, update, delete,
select) |
-| regex | String | Shadow column matching regular expression |
+| *Attribute Name* | *Data Type* | *Description* |
+| ---------- | ----------- | --------- |
+| foo | String | bar |
-## Hint Shadow Algorithm
+## Configuration sample
+- Java API
-### Simple Hint Shadow Algorithm
+```java
+public final class ShadowConfiguration {
+ // ...
+
+ private ShardingSphereAlgorithmConfiguration
createShadowAlgorithmConfiguration() {
+ Properties userIdInsertProps = new Properties();
+ userIdInsertProps.setProperty("operation", "insert");
+ userIdInsertProps.setProperty("column", "user_id");
+ userIdInsertProps.setProperty("value", "1");
+ return new ShardingSphereAlgorithmConfiguration("VALUE_MATCH",
userIdInsertProps));
+ }
+
+ // ...
+}
+```
-Type: SIMPLE_HINT
+- YAML:
+```yaml
+shadowAlgorithms:
+ user-id-insert-algorithm:
+ type: VALUE_MATCH
+ props:
+ column: user_id
+ operation: insert
+ value: 1
+```
-Attributes:
+- Spring Boot Starter:
+```properties
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.type=VALUE_MATCH
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.props.operation=insert
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.props.column=user_id
+spring.shardingsphere.rules.shadow.shadow-algorithms.user-id-insert-algorithm.props.value=1
+```
-> Configure at least a set of arbitrary key-value pairs. For example: foo:bar
-
-| *Name* | *DataType* | *Description* |
-| -------------- | --------- | --------- |
-| foo | String | bar |
+- Spring Namespace:
+```xml
+<shadow:shadow-algorithm id="user-id-insert-algorithm" type="VALUE_MATCH">
+ <props>
+ <prop key="operation">insert</prop>
+ <prop key="column">user_id</prop>
+ <prop key="value">1</prop>
+ </props>
+</shadow:shadow-algorithm>
+```
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.cn.md
index 85b2502ca8b..2919b1b52a9 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.cn.md
@@ -3,19 +3,68 @@ title = "影子库"
weight = 5
+++
-## 配置项说明
+## 背景信息
+如果您想在 Spring Boot 环境中使用 ShardingSphere 影子库功能请参考以下配置。
+
+## 参数解释
+### 配置入口
```properties
-spring.shardingsphere.datasource.names= # 省略数据源配置,请参考使用手册
+spring.shardingsphere.rules.shadow
+```
+
+### 可配置属性:
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| data-sources | 影子库逻辑数据源映射配置列表 | 无 |
+| tables | 影子表配置列表 | 无 |
+| shadowAlgorithms | 影子算法配置列表 | 无 |
+| default-shadow-algorithm-name | 默认影子算法名称 | 无,选配项 |
+
+### 影子数据源配置
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| source-data-source-name | 生产数据源名称 | 无 |
+| shadow-data-source-name | 影子数据源名称 | 无 |
+
+### 影子表配置
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| data-source-names | 影子表关联影子库逻辑数据源名称列表 | 无 |
+| shadow-algorithm-names | 影子表关联影子算法名称列表 | 无 |
+### 影子算法配置
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| type | 影子算法类型 | 无 |
+| props | 影子算法配置 | 无 |
+
+详情请参见[内置影子算法列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow)
+
+## 操作步骤
+1. 创建生产和影子数据源。
+2. 配置影子规则
+ - 配置影子数据源
+ - 配置影子表
+ - 配置影子算法
+
+## 配置示例
+```properties
spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.source-data-source-name=
# 生产数据源名称
spring.shardingsphere.rules.shadow.data-sources.shadow-data-source.shadow-data-source-name=
# 影子数据源名称
spring.shardingsphere.rules.shadow.tables.<table-name>.data-source-names= #
影子表关联影子数据源名称列表(多个值用","隔开)
spring.shardingsphere.rules.shadow.tables.<table-name>.shadow-algorithm-names=
# 影子表关联影子算法名称列表(多个值用","隔开)
-spring.shardingsphere.rules.shadow.defaultShadowAlgorithmName= # 默认影子算法名称,选配项。
+spring.shardingsphere.rules.shadow.defaultShadowAlgorithmName= # 默认影子算法名称,选配项
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.type=
# 影子算法类型
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.props.xxx=
# 影子算法属性配置
```
+
+## 相关参考
+- [影子库的特性描述](/cn/features/shadow/)
+- [JAVA API:影子库的配置
](/cn/user-manual/shardingsphere-jdbc/java-api/rules/shadow/)
+- [YAML
配置:影子库的配置](/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow/)
+- [Spring
命名空间:影子库的配置](/cn/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow/)
+- [开发者指南:影子库的接口和示例](/cn/dev-manual/shadow/)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.en.md
index 8529e0bd2da..7d3b4eb8d92 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow.en.md
@@ -3,8 +3,51 @@ title = "Shadow DB"
weight = 5
+++
-## Configuration Item Explanation
+## Background
+If you want to use the ShardingSphere Shadow DB feature in the Spring Boot
environment, please refer to the following configuration.
+## Parameters
+### Root Configuration
+```properties
+spring.shardingsphere.rules.shadow
+```
+
+### Configurable attributes
+| *Name* | *Description* | *Default Value* |
+| ------- | ------ | ----- |
+| data-sources | Shadow DB logical data source mapping configuration list |
none |
+| tables | Shadow table configuration list | none |
+| shadowAlgorithms | Shadow algorithm configuration list | none |
+| default-shadow-algorithm-name | Default shadow algorithm name | none,
options |
+
+### Shadow Data Source Configuration
+| *Name* | *Description* | *Default Value* |
+| ------- | ------ | ----- |
+| source-data-source-name | Production data source name | none |
+| shadow-data-source-name | Shadow data source name | none |
+
+### Shadow Table Configuration
+| *Name* | *Description* | *Default Value* |
+| ------- | ------ | ----- |
+| data-source-names | 影子表关联影子库逻辑数据源名称列表 | 无 |
+| shadow-algorithm-names | 影子表关联影子算法名称列表 | 无 |
+
+### Shadow Algorithm Configuration
+| *Name* | *Description* | *Default Value* |
+| ------- | ------ | ----- |
+| type | Shadow algorithm type | none|
+| props | Shadow algorithm configuration | none |
+
+For details, see [list of built-in shadow
algorithms](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow/)
+
+## Procedure
+1. Create production and shadow data sources.
+2. Configure shadow rules:
+ - Configure shadow data sources
+ - Configure shadow tables
+ - Configure shadow algorithm
+
+## Sample
```properties
spring.shardingsphere.datasource.names= # Omit the data source configuration,
please refer to the usage
@@ -19,3 +62,10 @@
spring.shardingsphere.rules.shadow.defaultShadowAlgorithmName= # Default shadow
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.type=
# Shadow algorithm type
spring.shardingsphere.rules.shadow.shadow-algorithms.<shadow-algorithm-name>.props.xxx=
# Shadow algorithm property configuration
```
+
+## Related References
+- [Feature Description of Shadow DB](/en/features/shadow/)
+- [JAVA API: Shadow DB
](/en/user-manual/shardingsphere-jdbc/java-api/rules/shadow/)
+- [YAML Configuration: Shadow
DB](/en/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow/)
+- [Spring Namespace: Shadow
DB](/en/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow/)
+- [Dev Guide: Shadow DB](/en/dev-manual/shadow/)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.cn.md
index 4f2506c3e4c..4bd9829f2cc 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.cn.md
@@ -3,51 +3,91 @@ title = "影子库"
weight = 5
+++
-## 配置项说明
+## 背景信息
+如果您只想使用 XML 配置文件方式配置使用 ShardingSphere 影子库功能请参考以下配置。
-命名空间:[http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow-5.1.2.xsd](http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow-5.1.2.xsd)
+## 参数解释
+### 配置入口
-\<shadow:rule />
+```xml
+<shadow:rule />
+```
-| *名称* | *类型* | *说明* |
-| ----- | ------ | ------ |
-| id | 属性 | Spring Bean Id |
-| data-source(?) | 标签 | 影子数据源配置 |
-| default-shadow-algorithm-name(?) | 标签 | 默认影子算法配置 |
-| shadow-table(?) | 标签 | 影子表配置 |
+### 可配置属性:
+| *名称* | *类型* | *说明* |
+| ------- | -------- | ------- |
+| id | 属性 | Spring Bean Id |
+| data-source(?) | 标签 | 影子库数据源映射配置 |
+| shadow-table(?) | 标签 | 影子表配置 |
+| shadow-algorithm(?) | 标签 | 影子表配置 |
+| default-shadow-algorithm-name(?) | 标签 | 默认影子算法名称 |
-\<shadow:data-source />
-
-| *名称* | *类型* | *说明* |
-| ----- | ------ | ------ |
+### 影子数据源配置:
+<shadow:data-source />
+| *名称* | *类型* | *说明* |
+| ------- | -------- | ------- |
| id | 属性 | Spring Bean Id |
| source-data-source-name | 属性 | 生产数据源名称 |
| shadow-data-source-name | 属性 | 影子数据源名称 |
-\<shadow:default-shadow-algorithm-name />
+### 影子表配置:
+<shadow:shadow-table />
+| *名称* | *类型* | *说明* |
+| ------- | -------- | ------- |
+| name | 属性 | 影子表名称 |
+| data-sources | 属性 | 影子表关联影子数据源名称列表(多个值用","隔开) |
+| algorithm (?) | 标签 | 影子表关联影子算法配置 |
+
+<shadow:algorithm />
+| *名称* | *类型* | *说明* |
+| ------- | -------- | ------- |
+| shadow-algorithm-ref | 属性 | 影子表关联影子算法名称 |
-| *名称* | *类型* | *说明* |
-| ----- | ------ | ------ |
-| name | 属性 | 默认影子算法名称 |
+### 影子算法配置:
+<shadow:shadow-algorithm />
+| *名称* | *类型* | *说明* |
+| ------- | -------- | ------- |
+| id | 属性 | 影子算法名称 |
+| type | 属性 | 影子算法类型 |
+| props (?) | 标签 | 影子算法属性配置 |
-\<shadow:shadow-table />
+详情请参见[内置影子算法列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow)
-| *名称* | *类型* | *说明* |
-| ----- | ------ | ------ |
-| name | 属性 | 影子表名称 |
-| data-sources | 属性 | 影子表关联影子数据源名称列表(多个值用","隔开)|
-| algorithm (?) | 标签 | 影子表关联影子算法配置 |
+## 操作步骤
+1. 创建生产和影子数据源。
+2. 配置影子规则
+ - 配置影子数据源
+ - 配置影子表
+ - 配置影子算法
-\<shadow:algorithm />
+## 配置示例
-| *名称* | *类型* | *说明* |
-| ----- | ------ | ------ |
-| shadow-algorithm-ref | 属性 | 影子表关联影子算法名称 |
+```xml
+<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:shadow="http://shardingsphere.apache.org/schema/shardingsphere/shadow"
xsi:schemaLocation="http://www.springframework.org/schema/beans
+
http://www.springframework.org/schema/beans/spring-beans.xsd
+
http://shardingsphere.apache.org/schema/shardingsphere/shadow
+
http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow.xsd
+ ">
+ <shadow:shadow-algorithm id="user-id-insert-match-algorithm"
type="VALUE_MATCH">
+ <props>
+ <prop key="operation">insert</prop>
+ <prop key="column">user_id</prop>
+ <prop key="value">1</prop>
+ </props>
+ </shadow:shadow-algorithm>
-\<shadow:shadow-algorithm />
+ <shadow:rule id="shadowRule">
+ <shadow:data-source id="shadow-data-source"
source-data-source-name="ds" shadow-data-source-name="ds_shadow"/>
+ <shadow:shadow-table name="t_user" data-sources="shadow-data-source">
+ <shadow:algorithm
shadow-algorithm-ref="user-id-insert-match-algorithm" />
+ </shadow:shadow-table>
+ </shadow:rule>
+</beans>
+```
-| *名称* | *类型* | *说明* |
-| --------- | ----- | ------------- |
-| id | 属性 | 影子算法名称 |
-| type | 属性 | 影子算法类型 |
-| props (?) | 标签 | 影子算法属性配置 |
+## 相关参考
+- [影子库的特性描述](/cn/features/shadow/)
+- [JAVA API:影子库的配置
](/cn/user-manual/shardingsphere-jdbc/java-api/rules/shadow/)
+- [YAML
配置:影子库的配置](/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow/)
+- [Spring
命名空间:影子库的配置](/cn/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow/)
+- [开发者指南:影子库的接口和示例](/cn/dev-manual/shadow/)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.en.md
index 07db6e09ee0..f0a20ad516b 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow.en.md
@@ -3,51 +3,90 @@ title = "Shadow DB"
weight = 5
+++
-## Configuration Item Explanation
+## Background
+Under the distributed application architecture based on microservices, the
business needs multiple services to be completed through a series of service
and middleware calls, so the stress test of a single service can no longer
represent the real scenario.
+In the test environment, rebuilding a complete set of pressure test
environments similar to the production environment would mean an excessively
high cost, and often an inability to simulate the complexity and flow of the
online environment.
+Therefore, enterprises usually select the full link voltage test method, i.e.
a pressure test in the production environment, so that the test results can
accurately reflect the system's real capacity and performance level.
-Namespace:
[http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow-5.1.2.xsd](http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow-5.1.2.xsd)
+## Parameters
+### Configuration Entry
+```xml
+<shadow:rule />
+```
-\<shadow:rule />
+### Configurable Properties:
+| *Name* | *Type* | *Description* |
+| ------- | -------- | ------- |
+| id | Attribute | Spring Bean Id |
+| data-source(?) | Tag | Shadow data source configuration |
+| shadow-table(?) | Tag | Shadow table configuration |
+| shadow-algorithm(?) | Tag | Shadow table configuration |
+| default-shadow-algorithm-name(?) | Tag | Default shadow algorithm
configuration |
-| *Name* | *Type* | *Description* |
-| ------ | ------- | ------------- |
-| id | Attribute | Spring Bean Id |
-| data-source(?) | Tag | Shadow data source configuration |
-| default-shadow-algorithm-name(?) | Tag | Default shadow algorithm
configuration |
-| shadow-table(?) | Tag | Shadow table configuration |
-
-\<shadow:data-source />
-
-| *Name* | *Type* | *Description* |
-| ------ | ------- | ------------- |
+### Shadow data source configuration:
+<shadow:data-source />
+| *Name* | *Type* | *Description* |
+| ------- | -------- | ------- |
| id | Attribute | Spring Bean Id |
| source-data-source-name | Attribute | Production data source name |
| shadow-data-source-name | Attribute | Shadow data source name |
-\<shadow:default-shadow-algorithm-name />
-
-| *Name* | *Type* | *Description* |
-| ----- | ------ | ------ |
-| name | Attribute | Default shadow algorithm name |
+### Shadow table configuration:
+<shadow:shadow-table />
+| *Name* | *Type* | *Description* |
+| ------- | -------- | ------- |
+| name | Attribute | Shadow table name|
+| data-sources | Attribute | Shadow table associated shadow data source name
list (multiple values are separated by ",") |
+| algorithm (?) | Tag | Shadow table association shadow algorithm
configuration |
-\<shadow:shadow-table />
+<shadow:algorithm />
+| *Name* | *Type* | *Description* |
+| ------- | -------- | ------- |
+| shadow-algorithm-ref | Attribute | Shadow table association shadow algorithm
name |
-| *Name* | *Type* | *Description* |
-| ------ | ------- | ------------- |
-| name | Attribute | Shadow table name |
-| data-sources | Attribute | Shadow table location shadow data source names
(multiple values are separated by ",") |
-| algorithm (?) | Tag | Shadow table location shadow algorithm configuration |
+### Shadow algorithm configuration:
+<shadow:shadow-algorithm />
+| *Name* | *Type* | *Description* |
+| ------- | -------- | ------- |
+| id | Attribute | Shadow algorithm name |
+| type | Attribute | Shadow algorithm type |
+| props (?) | Tag | Shadow algorithm attribute configuration |
+Refer to [Builin Shadow
Algorithm](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow/) for
details
-\<shadow:algorithm />
+## Procedure
+1. Create production and shadow data sources.
+2. Configure shadow rules.
+ - Configure shadow data sources.
+ - Configure shadow table.
+ - Configure shadow algorithm.
-| *Name* | *Type* | *Description* |
-| ------ | ------- | ------------- |
-| shadow-algorithm-ref | Attribute | Shadow table location shadow algorithm
name |
+## Sample
+```xml
+<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:shadow="http://shardingsphere.apache.org/schema/shardingsphere/shadow"
xsi:schemaLocation="http://www.springframework.org/schema/beans
+
http://www.springframework.org/schema/beans/spring-beans.xsd
+
http://shardingsphere.apache.org/schema/shardingsphere/shadow
+
http://shardingsphere.apache.org/schema/shardingsphere/shadow/shadow.xsd
+ ">
+ <shadow:shadow-algorithm id="user-id-insert-match-algorithm"
type="VALUE_MATCH">
+ <props>
+ <prop key="operation">insert</prop>
+ <prop key="column">user_id</prop>
+ <prop key="value">1</prop>
+ </props>
+ </shadow:shadow-algorithm>
-\<shadow:shadow-algorithm />
+ <shadow:rule id="shadowRule">
+ <shadow:data-source id="shadow-data-source"
source-data-source-name="ds" shadow-data-source-name="ds_shadow"/>
+ <shadow:shadow-table name="t_user" data-sources="shadow-data-source">
+ <shadow:algorithm
shadow-algorithm-ref="user-id-insert-match-algorithm" />
+ </shadow:shadow-table>
+ </shadow:rule>
+</beans>
+```
-| *Name* | *Type* | *Description* |
-| --------- | ----- | ------------- |
-| id | Attribute | Shadow algorithm name |
-| type | Attribute | Shadow algorithm type |
-| props (?) | Attribute | Shadow algorithm property configuration |
+## Related References
+- [Feature Description of Shadow DB](/en/features/shadow/)
+- [JAVA API: Shadow DB
](/en/user-manual/shardingsphere-jdbc/java-api/rules/shadow/)
+- [YAML Configuration: Shadow
DB](/en/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow/)
+- [Spring Namespace: Shadow
DB](/en/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow/)
+- [Dev Guide: Shadow DB](/en/dev-manual/shadow/)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.cn.md
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.cn.md
index ae29dd01fa6..30f8d2acf37 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.cn.md
@@ -3,25 +3,81 @@ title = "影子库"
weight = 6
+++
-## 配置项说明
+## 背景信息
+如果您想在 ShardingSphere-Proxy 中使用 ShardingSphere 影子库功能请参考以下配置。
+## 参数解释
+### 配置入口
+
+```yaml
+rules:
+- !SHADOW
+```
+
+### 可配置属性:
+
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| dataSources | 影子库逻辑数据源映射配置列表 | 无 |
+| tables | 影子表配置列表 | 无 |
+| defaultShadowAlgorithmName | 默认影子算法名称 | 无,选配项 |
+| shadowAlgorithms | 影子算法配置列表 | 无 |
+
+### 影子数据源配置
+
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| dataSourceName | 影子库逻辑数据源名称 | 无 |
+| sourceDataSourceName | 生产数据源名称 | 无 |
+| shadowDataSourceName | 影子数据源名称 | 无 |
+
+### 影子表配置
+
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| dataSourceNames | 影子表关联影子库逻辑数据源名称列表 | 无 |
+| shadowAlgorithmNames | 影子表关联影子算法名称列表 | 无 |
+
+### 影子算法配置
+| *名称* | *说明* | *默认值* |
+| ------- | ------ | ----- |
+| type | 影子算法类型 | 无 |
+| props | 影子算法配置 | 无 |
+
+详情请参见[内置影子算法列表](/cn/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow)
+
+## 操作步骤
+
+1. 创建生产和影子数据源
+2. 配置影子规则
+ - 配置影子数据源
+ - 配置影子表
+ - 配置影子算法
+
+## 配置示例
```yaml
rules:
- !SHADOW
dataSources:
shadowDataSource:
sourceDataSourceName: # 生产数据源名称
- shadowDataSourceName: # 影子数据源名称
+ shadowDataSourceName: # 影子数据源名称
tables:
<table-name>:
dataSourceNames: # 影子表关联影子数据源名称列表
- - <shadow-data-source>
+ - <shadow-data-source>
shadowAlgorithmNames: # 影子表关联影子算法名称列表
- <shadow-algorithm-name>
- defaultShadowAlgorithmName: # 默认影子算法名称
+ defaultShadowAlgorithmName: # 默认影子算法名称(选配项)
shadowAlgorithms:
<shadow-algorithm-name> (+): # 影子算法名称
type: # 影子算法类型
props: # 影子算法属性配置
- # ...
```
+
+## 相关参考
+
+- [影子库的核心特性](/cn/features/shadow/)
+- [JAVA API:影子库配置](/cn/user-manual/shardingsphere-jdbc/java-api/rules/shadow/)
+- [Spring Boot
Starter:影子库配置](/cn/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow/)
+- [Spring
命名空间:影子库配置](/cn/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow/)
diff --git
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.en.md
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.en.md
index 0a94563a05f..b27a2aca069 100644
---
a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.en.md
+++
b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/rules/shadow.en.md
@@ -3,25 +3,81 @@ title = "Shadow DB"
weight = 6
+++
-## Configuration Item Explanation
+## Background
+Please refer to the following configuration in order to use the ShardingSphere
shadow DB feature in ShardingSphere-Proxy.
+
+## Parameters
+### Configuration entry
```yaml
rules:
- - !SHADOW
- dataSources:
- shadowDataSource:
- sourceDataSourceName: # Production data source name
- shadowDataSourceName: # Shadow data source name
- tables:
- <table-name>:
- dataSourceNames: # Shadow table location shadow data source names
- - <shadow-data-source>
- shadowAlgorithmNames: # Shadow table location shadow algorithm names
- - <shadow-algorithm-name>
- defaultShadowAlgorithmName: # Default shadow algorithm name
- shadowAlgorithms:
- <shadow-algorithm-name> (+): # Shadow algorithm name
- type: # Shadow algorithm type
- props: # Shadow algorithm property configuration
- # ...
+- !SHADOW
```
+
+### Configurable attributes
+
+| *Name* | *Description* | *Default* |
+| ------- | ------ | ----- |
+| dataSources | shadow DB logical data source mapping the configuration list |
none |
+| tables | shadow table configuration list | none |
+| defaultShadowAlgorithmName | name of default shadow algorithm | none, option
|
+| shadowAlgorithms | shadow algorithm configuration list | none |
+
+### Shadow data source configuration
+
+| *Name* | *Description* | *Default* |
+| ------- | ------ | ----- |
+| dataSourceName | shadow DB logical data source name | 无 |
+| sourceDataSourceName | production data source name | 无 |
+| shadowDataSourceName | shadow data source name | 无 |
+
+### Shadow table configuration
+
+| *Name* | *Description* | *Default* |
+| ------- | ------ | ----- |
+| dataSourceNames | shadow table associates shadow DB logical data source name
list | 无 |
+| shadowAlgorithmNames | shadow table associates shadow algorithm name list |
无 |
+
+### Shadow algorithm configuration
+
+| *Name* | *Description* | *Default* |
+| ------- | ------ | ----- |
+| type | shadow algorithm type | none |
+| props | shadow algorithm configuration | none |
+
+Please refer to [Built-in shadow algorithm
list](/en/user-manual/shardingsphere-jdbc/builtin-algorithm/shadow) for more
details.
+
+## Procedure
+1. Create production and shadow data sources.
+2. Configure shadow rules.
+ - Configure the shadow data source.
+ - Configure the shadow table.
+ - Configure the shadow algorithm.
+
+## Sample
+
+```yaml
+rules:
+- !SHADOW
+ dataSources:
+ shadowDataSource:
+ sourceDataSourceName: # production data source name
+ shadowDataSourceName: # shadow data source name
+ tables:
+ <table-name>:
+ dataSourceNames: # shadow table associates shadow data source name list
+ - <shadow-data-source>
+ shadowAlgorithmNames: # shadow table associates shadow algorithm name
list
+ - <shadow-algorithm-name>
+ defaultShadowAlgorithmName: # default shadow algorithm name (option)
+ shadowAlgorithms:
+ <shadow-algorithm-name> (+): # shadow algorithm name
+ type: # shadow algorithm type
+ props: # shadow algorithm attribute configuration
+```
+
+## Related References
+- [Core Features of Shadow DB](/en/features/shadow/)
+- [JAVA API: Shadow DB
Configuration](/en/user-manual/shardingsphere-jdbc/java-api/rules/shadow/)
+- [Spring Boot Starter: Shadow DB
Configuration](/en/user-manual/shardingsphere-jdbc/spring-boot-starter/rules/shadow/)
+- [Spring Namespace: Shadow DB
Configuration](/en/user-manual/shardingsphere-jdbc/spring-namespace/rules/shadow/)