返回介绍

读写分离

发布于 2021-09-25 22:17:12 字数 3025 浏览 874 评论 0 收藏 0

定义

SHOW READWRITE_SPLITTING RULES [FROM schemaName]               

说明

说明
name规则名称
auto_aware_data_source_name自动发现数据源名称(配置动态读写分离规则显示)
write_data_source_name写数据源名称
read_data_source_names读数据源名称列表
load_balancer_type负载均衡算法类型
load_balancer_props负载均衡算法参数

示例

静态读写分离规则

mysql> show readwrite_splitting rules;
+------------+-------------------------+---------------------+--------------------------+------------------+------------------------+
| name       | auto_aware_data_source_name | write_data_source_name | read_data_source_names      | load_balancer_type | load_balancer_props      |
+------------+-------------------------+---------------------+--------------------------+------------------+------------------------+
| ms_group_0 | NULL                    | ds_primary          |  ds_slave_0, ds_slave_1  | random           |                        |
+------------+-------------------------+---------------------+--------------------------+------------------+------------------------+
1 row in set (0.00 sec)

动态读写分离规则

mysql> show readwrite_splitting rules from readwrite_splitting_db;
+-------+-------------------------+---------------------+---------------------+------------------+------------------------+
| name  | auto_aware_data_source_name | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props      |
+-------+-------------------------+---------------------+---------------------+------------------+------------------------+
| pr_ds | ms_group_0              | NULL                |                     | random           |  read_weight=2:1}      |
+-------+-------------------------+---------------------+---------------------+------------------+------------------------+
1 row in set (0.01 sec)

静态读写分离规则和动态读写分离规则

mysql> show readwrite_splitting rules from readwrite_splitting_db;
+-------+-------------------------+---------------------+------------------------+------------------+------------------------+
| name  | auto_aware_data_source_name | write_data_source_name | read_data_source_names    | load_balancer_type | load_balancer_props      |
+-------+-------------------------+---------------------+------------------------+------------------+------------------------+
| pr_ds | ms_group_0              | write_ds            |  read_ds_0, read_ds_1  | random           |  read_weight=2:1       |
+-------+-------------------------+---------------------+------------------------+------------------+------------------------+
1 row in set (0.00 sec)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文