shardingsphere springboot application.yml配置

shardingsphere  springboot application.yml配置

 

spring:
  sharding-sphere:
    datasource:
      names: master
      master:
        type: com.zaxxer.hikari.HikariDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        jdbc-url: jdbc:mysql://xxx.xxx.xxx.xxx:3306/databse?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&rewriteBatchedStatements=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
        username: test
        password: test@1024
        maximum-pool-size: 50 # 最大连接池数
        max-lifetime: 180000 # 连接的最长生周期,值0表示无限生命周期,默认1800000即30分钟
        minimum-idle: 5 # 最小空闲连接数量
        idle-timeout: 180000 # 空闲连接存活最大时间,默认600000 (10分钟)
        connection-timeout: 60000 #连接超时时间
        validation-timeout: 3000 #制连接测试活动的最长时间
        connection-test-query: select 1
      sharding:
        default-data-source-name: master
      tables:
        tbl_file_info:
          actual-data-nodes: master.tbl_file_info_$->{2023..2024}$->{(1..12).collect{t->t.toString().padLeft(2,'0')}},master.tbl_file_info_$->{2022}$->{(10..12).collect{t->t.toString().padLeft(2,'0')}}
          table-strategy:
            standard:
              sharding-column: create_time
              precise-aLorthn-cLass-name: xxx.xxx.TablePreciseShardingalgrithn #自定义分表,插入 或带create_time的精确查饰用
              range-algorithm-class-name: xxx.xxx.TablePreciseShardingAlgorithm #范围查询
      props:
        sql:
          show: true #打印sql
        executor:
          size: 10#工作线程数量,默认值: CPU核数
        allow:
          range:
            query:
              with:
                inline:
                sharding:true '#当使用inline分表策略时,是否允连范围查询,默认值:false

 

shardingDataSourceFactory  可以打断点查看配置

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章