Sharding
Class name: org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration
Attributes:
Sharding Table Configuration
Class name: org.apache.shardingsphere.sharding.api.config.ShardingTableRuleConfiguration
Attributes:
Name | DataType | Description | Default Value |
---|---|---|---|
logicTable | String | Name of sharding logic table | - |
actualDataNodes (?) | String | Describe data source names and actual tables, delimiter as point. Multiple data nodes split by comma, support inline expression | Broadcast table or databases sharding only |
databaseShardingStrategy (?) | ShardingStrategyConfiguration | Databases sharding strategy | Use default databases sharding strategy |
tableShardingStrategy (?) | ShardingStrategyConfiguration | Tables sharding strategy | Use default tables sharding strategy |
keyGenerateStrategy (?) | KeyGeneratorConfiguration | Key generator configuration | Use default key generator |
auditStrategy (?) | ShardingAuditStrategyConfiguration | Sharding audit strategy configuration | Use default auditor |
Class name: org.apache.shardingsphere.sharding.api.config.ShardingAutoTableRuleConfiguration
Attributes:
Sharding Strategy Configuration
Standard Sharding Strategy Configuration
Attributes:
Name | DataType | Description |
---|---|---|
shardingColumn | String | Sharding column name |
shardingAlgorithmName | String | Sharding algorithm name |
Complex Sharding Strategy Configuration
Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration
Attributes:
Hint Sharding Strategy Configuration
Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration
Attributes:
Name | DataType | Description |
---|---|---|
shardingAlgorithmName | String | Sharding algorithm name |
None Sharding Strategy Configuration
Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration
Please refer to Built-in Sharding Algorithm List for more details about type of algorithm.
Class name: org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration
Attributes:
Please refer to Built-in Key Generate Algorithm List for more details about type of algorithm.
Sharding audit Strategy Configuration
Class name:org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration
Attributes:
Name | DataType | Description |
---|---|---|
auditorNames | Collection<String> | Sharding audit algorithm name |
allowHintDisable | Boolean | Enable or disable sharding audit hint |
- Create an authentic data source mapping relationship, with key as the logical name of the data source and value as the DataSource object.
- Create the sharding rule object ShardingRuleConfiguration, and initialize the sharding table objects—ShardingTableRuleConfiguration, the set of bound tables, the set of broadcast tables, and parameters like library sharding strategy and the database sharding strategy, on which the data sharding depends.
- Using the ShardingSphereDataSource method of calling the ShardingSphereDataSourceFactory subject to create the ShardingSphereDataSource.