Readwrite Splitting #
Configuration Entry #
Class name: org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration
configurable properties:
Name | Data type | Description |
---|---|---|
dataSources (+) | Collection<ReadwriteSplittingDataSourceRuleConfiguration> | Readwrite data source configuration |
loadBalancers (*) | Map<String, ShardingSphereAlgorithmConfiguration> | Slave database load balance algorithm |
Master-Slave Data Source Configuration #
Class name: org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration
configurable properties:
Name | Data type | Description | Default value |
---|---|---|---|
name | String | Readwrite data source name | - |
staticStrategy | StaticReadwriteSplittingStrategyConfiguration | Static readwrite splitting configuration | - |
dynamicStrategy | DynamicReadwriteSplittingStrategyConfiguration | Dynamic readwrite splitting configuration | - |
loadBalancerName (?) | String | Read database load balancing algorithm name | Round robin load balancing algorithm |
Class name: org.apache.shardingsphere.readwritesplitting.api.strategy.StaticReadwriteSplittingStrategyConfiguration
configurable properties:
Name | Data type | Description |
---|---|---|
writeDataSourceName | String | Write data source list |
readDataSourceNames | List<String> | Read data source list |
Class name: org.apache.shardingsphere.readwritesplitting.api.strategy.DynamicReadwriteSplittingStrategyConfiguration
configurable properties:
Name | Data type | Description | Default value |
---|---|---|---|
autoAwareDataSourceName | String | Logical data source name of database discovery | - |
writeDataSourceQueryEnabled (?) | String | All read databases are offline, whether the master database bears the read traffic | true |
For details of load balance algorithm types, please refer to Built-in load balance algorithm list.