Logo
Readwrite-Splitting

Read/write Splitting #

Syntax #

SHOW READWRITE_SPLITTING RULES [FROM databaseName]

Return Value Description #

ColumnDescription
nameRule name
auto_aware_data_source_nameAuto-Aware discovery data source name (Display configuration dynamic readwrite splitting rules)
write_data_source_query_enabledAll read data source are offline, write data source whether the data source is responsible for read traffic
write_data_source_nameWrite data source name
read_data_source_namesRead data source name list
load_balancer_typeLoad balance algorithm type
load_balancer_propsLoad balance algorithm parameter

Example #

Static Readwrite Splitting Rules

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 |                             | ds_primary             | ds_slave_0, ds_slave_1 | random             |                     |
+------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
1 row in set (0.00 sec)

Dynamic Readwrite Splitting Rules

mysql> SHOW READWRITE_SPLITTING RULES FROM readwrite_splitting_db;
+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
| name         | auto_aware_data_source_name | write_data_source_query_enabled | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
| readwrite_ds | ms_group_0                  |                                 |                        |                        | random             | read_weight=2:1     |
+-------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
1 row in set (0.01 sec)

Static Readwrite Splitting Rules And Dynamic Readwrite Splitting Rules

mysql> SHOW READWRITE_SPLITTING RULES FROM readwrite_splitting_db;
+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
| name         | auto_aware_data_source_name | write_data_source_query_enabled | write_data_source_name | read_data_source_names | load_balancer_type | load_balancer_props |
+--------------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
| readwrite_ds | ms_group_0                  |                                 | write_ds               | read_ds_0, read_ds_1   | random             | read_weight=2:1     |
+-------+-----------------------------+------------------------+------------------------+--------------------+---------------------+
1 row in set (0.00 sec)