Sharding

Configuration Item Explanation

  1. spring.shardingsphere.datasource.names= # Omit the data source configuration, please refer to the usage
  2. # Standard sharding table configuration
  3. spring.shardingsphere.rules.sharding.tables.<table-name>.actual-data-nodes= # Describe data source names and actual tables, delimiter as point, multiple data nodes separated with comma, support inline expression. Absent means sharding databases only.
  4. # Databases sharding strategy, use default databases sharding strategy if absent. sharding strategy below can choose only one.
  5. # For single sharding column scenario
  6. spring.shardingsphere.rules.sharding.tables.<table-name>.database-strategy.standard.sharding-column= # Sharding column name
  7. spring.shardingsphere.rules.sharding.tables.<table-name>.database-strategy.standard.sharding-algorithm-name= # Sharding algorithm name
  8. # For multiple sharding columns scenario
  9. spring.shardingsphere.rules.sharding.tables.<table-name>.database-strategy.complex.sharding-columns= # Sharding column names, multiple columns separated with comma
  10. spring.shardingsphere.rules.sharding.tables.<table-name>.database-strategy.complex.sharding-algorithm-name= # Sharding algorithm name
  11. # Sharding by hint
  12. spring.shardingsphere.rules.sharding.tables.<table-name>.database-strategy.hint.sharding-algorithm-name= # Sharding algorithm name
  13. # Tables sharding strategy, same as database sharding strategy
  14. spring.shardingsphere.rules.sharding.tables.<table-name>.table-strategy.xxx= # Omitted
  15. # Auto sharding table configuraiton
  16. spring.shardingsphere.rules.sharding.auto-tables.<auto-table-name>.actual-data-sources= # data source names
  17. spring.shardingsphere.rules.sharding.auto-tables.<auto-table-name>.sharding-strategy.standard.sharding-column= # Sharding column name
  18. spring.shardingsphere.rules.sharding.auto-tables.<auto-table-name>.sharding-strategy.standard.sharding-algorithm= # Auto sharding algorithm name
  19. # Key generator strategy configuration
  20. spring.shardingsphere.rules.sharding.tables.<table-name>.key-generate-strategy.column= # Column name of key generator
  21. spring.shardingsphere.rules.sharding.tables.<table-name>.key-generate-strategy.key-generator-name= # Key generator name
  22. spring.shardingsphere.rules.sharding.binding-tables[0]= # Binding table name
  23. spring.shardingsphere.rules.sharding.binding-tables[1]= # Binding table name
  24. spring.shardingsphere.rules.sharding.binding-tables[x]= # Binding table name
  25. spring.shardingsphere.rules.sharding.broadcast-tables[0]= # Broadcast tables
  26. spring.shardingsphere.rules.sharding.broadcast-tables[1]= # Broadcast tables
  27. spring.shardingsphere.rules.sharding.broadcast-tables[x]= # Broadcast tables
  28. spring.shardingsphere.sharding.default-database-strategy.xxx= # Default strategy for database sharding
  29. spring.shardingsphere.sharding.default-table-strategy.xxx= # Default strategy for table sharding
  30. spring.shardingsphere.sharding.default-key-generate-strategy.xxx= # Default Key generator strategy
  31. spring.shardingsphere.sharding.default-sharding-column= # Default sharding column name
  32. # Sharding algorithm configuration
  33. spring.shardingsphere.rules.sharding.sharding-algorithms.<sharding-algorithm-name>.type= # Sharding algorithm type
  34. spring.shardingsphere.rules.sharding.sharding-algorithms.<sharding-algorithm-name>.props.xxx=# Sharding algorithm properties
  35. # Key generate algorithm configuration
  36. spring.shardingsphere.rules.sharding.key-generators.<key-generate-algorithm-name>.type= # Key generate algorithm type
  37. spring.shardingsphere.rules.sharding.key-generators.<key-generate-algorithm-name>.props.xxx= # Key generate algorithm properties

Please refer to Built-in Sharding Algorithm List and Built-in Key Generate Algorithm List for more details about type of algorithm.

Attention

Inline expression identifier can use ${...} or $->{...}, but ${...} is conflict with spring placeholder of properties, so use $->{...} on spring environment is better.