sharding:
  jdbc:
    datasource:
      names: ds,ds-0,ds-1
      ds:
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://${zlt.datasource.ip}:3306/demo_ds?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
        username: ${zlt.datasource.username}
        password: ${zlt.datasource.password}
      ds-0:
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://${zlt.datasource.ip}:3306/demo_ds_0?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
        username: ${zlt.datasource.username}
        password: ${zlt.datasource.password}
      ds-1:
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql://${zlt.datasource.ip}:3306/demo_ds_1?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
        username: ${zlt.datasource.username}
        password: ${zlt.datasource.password}
    config:
      sharding:
        default-data-source-name: ds
        default-database-strategy:
          inline:
            sharding-column: id
            algorithm-expression: ds-$->{id % 2}
        tables:
          user:
            actual-data-nodes: ds-$->{0..1}.user
            key-generator-column-name: id
      props:
        sql:
          show: true