As the core of Sharding-JDBC, configuration is the only module in Sharding-JDBC that has something to do with application developers. Configuration module is also the portal of Sharding-JDBC, through which users can fast and clearly understand the functions provided by Sharding-JDBC.
This part is a configuration manual for Sharding-JDBC, which can also be referred to as a dictionary if necessary.
Sharding-JDBC has provided 4 kinds of configuration methods for different situations. By configuration, application developers can flexibly use sharding databases with sharding tables, read-write split or the combination of both.
The yellow part in the diagram indicates the API entrance of Sharding-JDBC, provided in factory method. There are two kinds of factories,
MasterSlaveDataSourceFactory for now.
ShardingDataSourceFactory is used to create JDBC drivers of sharding databases with sharding tables or sharding databases with sharding tables+read-write split;
MasterSlaveDataSourceFactory is used to create JDBC drivers of read-write split.
The yellow part in the diagram indicates configuration objects of Sharding-JDBC, which provides flexible configuration methods.
ShardingRuleConfiguration is the core and entrance of sharding database and sharding table configuration, which can include many
MasterSlaveRuleConfiguration. Each group of sharding tables with same rules is set with a
TableRuleConfiguration. If sharding databases with sharding tables and read-write split are used together, each logic database of read-write split is set with a
TableRuleConfiguration is corresponding to a
ShardingStrategyConfiguration and it has 5 types to choose.
Read-write split uses
The red part in the diagram indicates internal objects, which are used in Sharding-JDBC and needless to be focused by application developers. Sharding-JDBC uses
MasterSlaveRuleConfiguration to generate rule objects used by
MasterSlaveDataSource. Implemented with
MasterSlaveDataSource are complete implementation schemes of JDBC.
DataSourceobjects to split databases.
org.apache.shardingsphere.shardingjdbc.api packages are API open to users, the modifications of which will be declared in release notes. As internal implementations, classes in other packages can adjust any time,
please not use them directly.