hint-databases-tables.yaml 1.1 KB
Newer Older
C
cherrylzhao 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
dataSources:
  ds_0: !!com.zaxxer.hikari.HikariDataSource
    driverClassName: com.mysql.jdbc.Driver
    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0
    username: root
    password:
  ds_1: !!com.zaxxer.hikari.HikariDataSource
    driverClassName: com.mysql.jdbc.Driver
    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1
    username: root
    password:

shardingRule:
  tables:
    t_order: 
16
      actualDataNodes: ds_${0..1}.t_order_${0..1}
C
cherrylzhao 已提交
17 18 19
      databaseStrategy:
        hint:
          algorithmClassName: io.shardingsphere.example.hint.raw.jdbc.ModuloHintShardingAlgorithm
20 21 22
      tableStrategy:
        hint:
          algorithmClassName: io.shardingsphere.example.hint.raw.jdbc.ModuloHintShardingAlgorithm
C
cherrylzhao 已提交
23 24 25 26
      keyGenerator:
        type: SNOWFLAKE
        column: order_id
    t_order_item:
27
      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
C
cherrylzhao 已提交
28 29 30 31 32 33 34 35 36 37 38 39
  bindingTables:
    - t_order,t_order_item
  
  defaultDatabaseStrategy:
    inline:
      shardingColumn: user_id
      algorithmExpression: ds_${user_id % 2}
  defaultTableStrategy:
    none:

props:
  sql.show: true