1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
| #单库分表配置
| spring:
| shardingsphere:
| props:
| sql-show: true
| datasource:
| #添加分库数据源
| ds0:
| driverClassName: com.mysql.cj.jdbc.Driver
| url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
| username: root
| password: root
| type: com.alibaba.druid.pool.DruidDataSource
| names: ds0
| # 规则配置
| rules:
| sharding:
| # 配置绑定表,每一行为一组
| binding-tables: sys_log
| # 分布式序列算法配置
| key-generators:
| snowflake:
| type: SNOWFLAKE
| props:
| worker-id: 123
| # 分片算法配置
| sharding-algorithms:
| table-classbased:
| props:
| strategy: standard
| # 自定义标准分配算法
| algorithmClassName: org.jeecg.modules.test.sharding.algorithm.StandardModTableShardAlgorithm
| type: CLASS_BASED
| tables:
| # 逻辑表名称
| sys_log:
| #配置具体表的数据节点
| actual-data-nodes: ds0.sys_log$->{0..1}
| # 分表策略
| table-strategy:
| standard:
| # 分片算法名称
| sharding-algorithm-name: table-classbased
| # 分片列名称(对应数据库字段)
| sharding-column: log_type
|
|