shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

How to configure default data sources in version 5.*

Open robben009 opened this issue 3 months ago • 1 comments

I have some tables that do not require splitting, how should I configure the default data source? As shown in the figure below, I hope that all tables except the tbreorder table do not need to be split. How should I configure it at this time?

dataSources:
  ds_0:
    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
    driverClassName: com.mysql.jdbc.Driver
    jdbcUrl: jdbc:mysql://***
    username: ***
    password: ***
    hikari:
      minimum-idle: 200 
      maximum-pool-size: 200 
      idle-timeout: 600000 
      auto-commit: true 
      pool-name: playHikariPool 
      max-lifetime: 1800000 
      connection-timeout: 30000 
      connection-test-query: Select 1

rules:
  - !SHARDING
    tables:
      tb_order:
        actualDataNodes: ds_0.tb_order_${0..1}
        tableStrategy:
          standard:
            shardingColumn: customer_id
            shardingAlgorithmName: LastCharShardingAlgorithm
        keyGenerateStrategy:
          column: id
          keyGeneratorName: snowflake
    bindingTables:
      - tb_order
    shardingAlgorithms:
      LastCharShardingAlgorithm:
        type: CLASS_BASED
        props:
          strategy: STANDARD
          algorithmClassName: *
    keyGenerators:
      snowflake:
        type: SNOWFLAKE

robben009 avatar May 10 '24 08:05 robben009