Logo
Data sharding

Data sharding #

Description of configuration items #

rules:
- !SHARDING
  tables: # Sharding Configuration
    <logic-table-name> (+): # Logic table name
      actualDataNodes (?): # Composed of data source name + table name (refer to Inline syntax rules)
      databaseStrategy (?): # Sharding database strategy,The default means to use the default sharding strategy, and only one of the following sharding strategies can be selected
        standard: # Standard sharding scenario for single sharding key
          shardingColumn: # Sharding column name
          shardingAlgorithmName: # Sharding Algorithm name
        complex: # Composite sharding scenario for multiple sharding keys
          shardingColumns: # Sharding column name,multi column split with comma
          shardingAlgorithmName: # Sharding algorithm name
        hint: # Hint sharding strategy
          shardingAlgorithmName: # Sharding algorithm name
        none: # None sharding
      tableStrategy: # Sharding table strategy, same as sharding database strategy
      keyGenerateStrategy: # Distributed sequence strategy
        column: # Auto-increment column name, the default means not to use auto-increment primary key generator
        keyGeneratorName: # Distributed Sequence Algorithm Name
  autoTables: # Auto sharding table rule configuration
    t_order_auto: # Logic table name
      actualDataSources (?): # Data source name
      shardingStrategy: # Sharding strategy
        standard: # Standard sharding scenario for single sharding key
          shardingColumn: # Sharding column name
          shardingAlgorithmName: # Auto sharding algorithm name
  bindingTables (+): # Reference table list
    - <logic_table_name_1, logic_table_name_2, ...> 
    - <logic_table_name_1, logic_table_name_2, ...> 
  broadcastTables (+): # Broadcast table list
    - <table-name>
    - <table-name>
  defaultDatabaseStrategy: # Default sharding database strategy
  defaultTableStrategy: # Default sharding table strategy
  defaultKeyGenerateStrategy: # Default distributed sequence strategy
  defaultShardingColumn: # Default sharding column
  
  # Sharding algorithm configuration
  shardingAlgorithms:
    <sharding-algorithm-name> (+): # Sharding algorithm name
      type: # Sharding algorithm type
      props: # Sharding algorithm properties
      # ...
  
  # Distributed Sequence Algorithm Configuration
  keyGenerators:
    <key-generate-algorithm-name> (+): # Distributed Sequence Algorithm Name
      type: # Distributed Sequence Algorithm Name
      props: # Distributed Sequence Algorithm Properties
      # ...