影子库压测
- 重复的无法被创建
resourceMapping
指定源数据库和影子库的映射关系,需使用 RDL 管理的 resource
,请参考 数据源资源shadowAlgorithm
可同时作用于多个 shadowTableRule
algorithmName
未指定时会根据 ruleName
、tableName
和 shadowAlgorithmType
自动生成shadowAlgorithmType
目前支持 COLUMN_REGEX_MATCH
和 SIMPLE_NOTE
shadowAlgorithm
能够被不同的 shadowTableRule
复用,因此在执行 ALTER SHADOW RULE
时,对应的 shadowAlgorithm
不会被移除
示例
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")))));
SOURCE=demo_ds,
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;