文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
读写分离
定义
CREATE READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition [, readwriteSplittingRuleDefinition] ...
ALTER READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition [, readwriteSplittingRuleDefinition] ...
DROP READWRITE_SPLITTING RULE ruleName [, ruleName] ...
readwriteSplittingRuleDefinition:
ruleName ([staticReadwriteSplittingRuleDefinition | dynamicReadwriteSplittingRuleDefinition]
[, loadBanlancerDefinition])
staticReadwriteSplittingRuleDefinition:
WRITE_RESOURCE=writeResourceName, READ_RESOURCES(resourceName [, resourceName] ... )
dynamicReadwriteSplittingRuleDefinition:
AUTO_AWARE_RESOURCE=resourceName
loadBanlancerDefinition:
TYPE(NAME=loadBanlancerType [, PROPERTIES([algorithmProperties] )] )
algorithmProperties:
algorithmProperty [, algorithmProperty] ...
algorithmProperty:
key=value
- 支持创建静态读写分离规则和动态读写分离规则
- 动态读写分离规则依赖于数据库发现规则
loadBanlancerType
指定负载均衡算法类型,请参考 负载均衡算法- 重复的
ruleName
将无法被创建
示例
// Static
CREATE READWRITE_SPLITTING RULE ms_group_0 (
WRITE_RESOURCE=write_ds,
READ_RESOURCES(read_ds_0,read_ds_1),
TYPE(NAME=random)
);
// Dynamic
CREATE READWRITE_SPLITTING RULE ms_group_1 (
AUTO_AWARE_RESOURCE=group_0,
TYPE(NAME=random,PROPERTIES(read_weight='2:1'))
);
ALTER READWRITE_SPLITTING RULE ms_group_1 (
WRITE_RESOURCE=write_ds,
READ_RESOURCES(read_ds_0,read_ds_1,read_ds_2),
TYPE(NAME=random,PROPERTIES(read_weight='2:0'))
);
DROP READWRITE_SPLITTING RULE ms_group_1;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论