Sharding

Configuration Item Explanation

  1. dataSources: # Omit the data source configuration, please refer to the usage
  2. rules:
  3. - !SHARDING
  4. tables: # Sharding table configuration
  5. <logic-table-name> (+): # Logic table name
  6. actualDataNodes (?): # Describe data source names and actual tables (refer to Inline syntax rules)
  7. databaseStrategy (?): # Databases sharding strategy, use default databases sharding strategy if absent. sharding strategy below can choose only one.
  8. standard: # For single sharding column scenario
  9. shardingColumn: # Sharding column name
  10. shardingAlgorithmName: # Sharding algorithm name
  11. complex: # For multiple sharding columns scenario
  12. shardingColumns: # Sharding column names, multiple columns separated with comma
  13. shardingAlgorithmName: # Sharding algorithm name
  14. hint: # Sharding by hint
  15. shardingAlgorithmName: # Sharding algorithm name
  16. none: # Do not sharding
  17. tableStrategy: # Tables sharding strategy, same as database sharding strategy
  18. keyGenerateStrategy: # Key generator strategy
  19. column: # Column name of key generator
  20. keyGeneratorName: # Key generator name
  21. autoTables: # Auto Sharding table configuration
  22. t_order_auto: # Logic table name
  23. actualDataSources (?): # Data source names
  24. shardingStrategy: # Sharding strategy
  25. standard: # For single sharding column scenario
  26. shardingColumn: # Sharding column name
  27. shardingAlgorithmName: # Auto sharding algorithm name
  28. bindingTables (+): # Binding tables
  29. - <logic_table_name_1, logic_table_name_2, ...>
  30. - <logic_table_name_1, logic_table_name_2, ...>
  31. broadcastTables (+): # Broadcast tables
  32. - <table-name>
  33. - <table-name>
  34. defaultDatabaseStrategy: # Default strategy for database sharding
  35. defaultTableStrategy: # Default strategy for table sharding
  36. defaultKeyGenerateStrategy: # Default Key generator strategy
  37. defaultShardingColumn: # Default sharding column name
  38. # Sharding algorithm configuration
  39. shardingAlgorithms:
  40. <sharding-algorithm-name> (+): # Sharding algorithm name
  41. type: # Sharding algorithm type
  42. props: # Sharding algorithm properties
  43. # ...
  44. # Key generate algorithm configuration
  45. keyGenerators:
  46. <key-generate-algorithm-name> (+): # Key generate algorithm name
  47. type: # Key generate algorithm type
  48. props: # Key generate algorithm properties
  49. # ...
  50. props:
  51. # ...