Logo
Readwrite Splitting

Readwrite Splitting #

Configuration Entry #

Class name: org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration

configurable properties:

NameData typeDescription
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:

NameData typeDescriptionDefault value
nameStringReadwrite data source name-
staticStrategyStaticReadwriteSplittingStrategyConfigurationStatic readwrite splitting configuration-
dynamicStrategyDynamicReadwriteSplittingStrategyConfigurationDynamic readwrite splitting configuration-
loadBalancerName (?)StringRead database load balancing algorithm nameRound robin load balancing algorithm

Class name: org.apache.shardingsphere.readwritesplitting.api.strategy.StaticReadwriteSplittingStrategyConfiguration

configurable properties:

NameData typeDescription
writeDataSourceNameStringWrite data source list
readDataSourceNamesList<String>Read data source list

Class name: org.apache.shardingsphere.readwritesplitting.api.strategy.DynamicReadwriteSplittingStrategyConfiguration

configurable properties:

NameData typeDescriptionDefault value
autoAwareDataSourceNameStringLogical data source name of database discovery-
writeDataSourceQueryEnabled (?)StringAll read databases are offline, whether the master database bears the read traffictrue

For details of load balance algorithm types, please refer to Built-in load balance algorithm list.