Data Sharding #
Configuration Entry #
Class name: org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration
configurable properties:
Name | Data type | Description | Default value |
---|---|---|---|
tables (+) | Collection<ShardingTableRuleConfiguration> | List of sharding table rules | - |
autoTables (+) | Collection<ShardingAutoTableRuleConfiguration> | List of auto sharding table rules | - |
bindingTableGroups (*) | Collection<String> | List of binding table rules | None |
broadcastTables (*) | Collection<String> | List of broadcast table rules | None |
defaultDatabaseShardingStrategy (?) | ShardingStrategyConfiguration | Default sharding database strategy | None sharding |
defaultTableShardingStrategy (?) | ShardingStrategyConfiguration | Default sharding table strategy | None sharding |
defaultKeyGenerateStrategy (?) | KeyGeneratorConfiguration | Default key generator configuration | Snowflake algorithm |
defaultShardingColumn (?) | String | Default sharding column name | None |
shardingAlgorithms (+) | Map<String, ShardingSphereAlgorithmConfiguration> | Sharding algorithm name and configuration | None |
keyGenerators (?) | Map<String, ShardingSphereAlgorithmConfiguration> | Key generator name and configuration | None |
Sharding Table Configuration #
Class name: org.apache.shardingsphere.sharding.api.config.ShardingTableRuleConfiguration
configurable properties:
Name | Data type | Description | Default value |
---|---|---|---|
logicTable | String | Logical sharding table name | - |
actualDataNodes (?) | String | It consists of data source name + table name, separated by decimal points. Multiple tables are separated by commas, and row value expressions are supported | Use known data sources and logical table names to generate data nodes, which are used for broadcast tables or when only sharding databases are not sharding tables and the table structures of all databases are exactly the same |
databaseShardingStrategy (?) | ShardingStrategyConfiguration | Sharding database strategy | Using default sharding database strategy |
tableShardingStrategy (?) | ShardingStrategyConfiguration | Sharding table strategy | Using default sharding table strategy |
keyGenerateStrategy (?) | KeyGeneratorConfiguration | Key generator | Using default key generator |
Auto Sharding Table Configuration #
Class name:org.apache.shardingsphere.sharding.api.config.ShardingAutoTableRuleConfiguration
configurable properties:
Name | Data type | Description | Default value |
---|---|---|---|
logicTable | String | Logical sharding table name | - |
actualDataSources (?) | String | Data source name, multiple data sources separated by commas | Use all configured data sources |
shardingStrategy (?) | ShardingStrategyConfiguration | Sharding strategy | Using default sharding strategy |
keyGenerateStrategy (?) | KeyGeneratorConfiguration | Key generator | Using default key generator |
Sharding Strategy Configuration #
Standard Sharding Strategy Configuration #
Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration
configurable properties:
Name | Data type | 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
configurable properties:
Name | Data type | Description |
---|---|---|
shardingColumns | String | Sharding column name, multiple columns separated by commas |
shardingAlgorithmName | String | Sharding algorithm name |
Hint Sharding Strategy Configuration #
Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.HintShardingStrategyConfiguration
configurable properties:
Name | Data type | Description |
---|---|---|
shardingAlgorithmName | String | Sharding algorithm name |
None Sharding Strategy Configuration #
Class name: org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration
configurable properties: None
For details of sharding algorithm types, please refer to Built-in sharding algorithms list。
Distributed Key Generate Strategy Configuration #
Class name: org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration
configurable properties:
Name | Data type | Description |
---|---|---|
column | String | Distributed key generate column name |
keyGeneratorName | String | Distributed key generate algorithm name |
For details of key generator algorithm types, please refer to Built-in key generator algorithm list。