配置文件
spring:
shardingsphere:
props:
sql-show: true
mode:
type: Memory
datasource:
ds0:
driver-class-name: com.mysql.cj.jdbc.Driver
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://172.16.16.8:13306/hxss-data?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: hxcm
password: hxcm123
names: ds0
rules:
sharding:
#key生成策略
key-generators:
snowflake:
props:
worker-id: 1
type: SNOWFLAKE
#配置分片算法
sharding-algorithms:
dateYYYYMMTablePreciseAlgorithm:
props:
algorithm-expression: ds0.t_device_exposure_data_$->{202311..202312},ds0.t_device_exposure_data_$->{202401..202412},
algorithm-class-name: com.hxcm.exposure.algorithms.DateYYYYMMTablePreciseAlgorithm
allow-range-query-with-inline-sharding: true
type: STANDARD_MOD
tables:
t_device_exposure_data:
#真实的数据节点
actual-data-nodes: ds0.t_device_exposure_data_$->{202311..202312},ds0.t_device_exposure_data_$->{202401..202412}
table-strategy:
standard:
sharding-column: create_time
sharding-algorithm-name: dateYYYYMMTablePreciseAlgorithm
binding-tables:
- t_device_exposure_data
default-database-strategy:
none:
default-table-strategy:
none:
check.tablemmetadate.enabled: false
mybatis-plus:
typeAliasesPackage: com.hxcm..domain
mapperLocations: classpath*:mapper//*Mapper.xml