文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
读写分离
定义
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论