拆分独立微服务测试模块jeecg-cloud-test,提供更多测试示例: 分布式事务、分库分表、mq、xxljob等

This commit is contained in:
zhangdaiscott
2022-02-26 17:43:55 +08:00
parent aae16f51e0
commit 912369181d
34 changed files with 701 additions and 350 deletions

View File

@ -3,9 +3,10 @@ spring:
props:
sql-show: true
datasource:
#添加分库数据源
ds0:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
url: jdbc:mysql://localhost:3300/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
type: com.alibaba.druid.pool.DruidDataSource
password: root
@ -26,7 +27,8 @@ spring:
table-classbased:
props:
strategy: standard
algorithmClassName: org.jeecg.modules.test.sharding.algorithm.StandardModTableShardAlgorithm
# 自定义标准分配算法
algorithmClassName: org.jeecg.modules.demo.sharding.algorithm.StandardModTableShardAlgorithm
type: CLASS_BASED
tables:
# 逻辑表名称
@ -38,5 +40,5 @@ spring:
standard:
# 分片算法名称
sharding-algorithm-name: table-classbased
# 分片列名称
# 分片列名称(对应数据库字段)
sharding-column: log_type

View File

@ -0,0 +1,72 @@
# 双库分表配置
spring:
shardingsphere:
props:
sql-show: true
datasource:
ds0:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: root
ds1:
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/jeecg-boot2?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: root
names: ds0,ds1
# 规则配置
rules:
replica-query:
# 负载均衡算法
load-balancers:
round-robin:
type: ROUND_ROBIN
props:
default: 0
data-sources:
prds:
primary-data-source-name: ds0
replica-data-source-names: ds1
load-balancer-name: round_robin
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
# 通过operate_type取模的方式确定数据落在哪个库
database-inline:
type: INLINE
props:
algorithm-expression: ds$->{operate_type % 2}
tables:
# 逻辑表名称
sys_log:
#配置具体表的数据节点
actual-data-nodes: ds$->{0..1}.sys_log$->{0..1}
# 分库策略
database-strategy:
standard:
sharding-column: operate_type
sharding-algorithm-name: database-inline
# 分表策略
table-strategy:
standard:
# 分片算法名称
sharding-algorithm-name: table-classbased
# 分片列名称
sharding-column: log_type