Shadow
Definition
CREATE SHADOW RULE shadowRuleDefinition [, shadowRuleDefinition] ...
ALTER SHADOW RULE shadowRuleDefinition [, shadowRuleDefinition] ...
ALTER SHADOW ALGORITHM shadowAlgorithm [, shadowAlgorithm] ...
DROP SHADOW RULE ruleName [, ruleName] ...
DROP SHADOW ALGORITHM algorithmName [, algorithmName] ...
shadowRuleDefinition: ruleName(resourceMapping, shadowTableRule [, shadowTableRule] ...)
resourceMapping: SOURCE=resourceName, SHADOW=resourceName
shadowTableRule: tableName(shadowAlgorithm [, shadowAlgorithm] ...)
shadowAlgorithm: ([algorithmName, ] TYPE(NAME=shadowAlgorithmType, PROPERTIES([algorithmProperties] ...)))
algorithmProperties: algorithmProperty [, algorithmProperty] ...
algorithmProperty: key=value
- Duplicate
ruleName
cannot be created resourceMapping
specifies the mapping relationship between the source database and the shadow library. You need to use theresource
managed by RDL, please refer to resourceshadowAlgorithm
can act on multipleshadowTableRule
at the same time- If
algorithmName
is not specified, it will be automatically generated according toruleName
,tableName
andshadowAlgorithmType
shadowAlgorithmType
currently supportsCOLUMN_REGEX_MATCH
andSIMPLE_NOTE
shadowTableRule
can be reused by differentshadowRuleDefinition
, so when executingDROP SHADOW RULE
, the correspondingshadowTableRule
will not be removedshadowAlgorithm
can be reused by differentshadowTableRule
, so when executingALTER SHADOW RULE
, the correspondingshadowAlgorithm
will not be removed
Example
CREATE SHADOW RULE shadow_rule(
SOURCE=demo_ds,
SHADOW=demo_ds_shadow,
t_order((simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", foo="bar"))),(TYPE(NAME=COLUMN_REGEX_MATCH, PROPERTIES("operation"="insert","column"="user_id", "regex"='[1]')))),
t_order_item((TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", "foo"="bar")))));
ALTER SHADOW RULE shadow_rule(
SOURCE=demo_ds,
SHADOW=demo_ds_shadow,
t_order((simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", foo="bar"))),(TYPE(NAME=COLUMN_REGEX_MATCH, PROPERTIES("operation"="insert","column"="user_id", "regex"='[1]')))),
t_order_item((TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", "foo"="bar")))));
ALTER SHADOW ALGORITHM
(simple_note_algorithm, TYPE(NAME=SIMPLE_NOTE, PROPERTIES("shadow"="true", "foo"="bar"))),
(user_id_match_algorithm, TYPE(NAME=COLUMN_REGEX_MATCH,PROPERTIES("operation"="insert", "column"="user_id", "regex"='[1]')));
DROP SHADOW RULE shadow_rule;
DROP SHADOW ALGORITHM simple_note_algorithm;
当前内容版权归 ShardingSphere 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 ShardingSphere .