提交 e6b0d8e1 authored 作者: 陈世营's avatar 陈世营

base transacton test

上级 1e59d20f
......@@ -14,7 +14,7 @@
<properties>
<java.version>1.8</java.version>
<sharding-sphere.version>4.0.0</sharding-sphere.version>
<sharding-sphere.version>4.0.0-RC3</sharding-sphere.version>
<lombok.version>1.16.4</lombok.version>
<mybatis-plus-boot-starter.version>3.3.1</mybatis-plus-boot-starter.version>
<druid-spring-boot-starter.version>1.1.10</druid-spring-boot-starter.version>
......
......@@ -5,6 +5,10 @@ spring:
application:
name: loit-shardingshere
cloud:
alibaba:
seata:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应
tx-service-group: loit-shardingshere-seata-service-group
nacos:
discovery:
# Nacos 注册中心地址
......@@ -14,15 +18,15 @@ spring:
proxy-target-class: true
shardingsphere:
datasource:
names: ds-master,ds-slave-0
ds-master:
names: ds0,ds1
ds0:
type: com.alibaba.druid.pool.DruidDataSource
# type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
username: root
password: loit2019ABC
jdbc-url: jdbc:mysql://192.168.66.40:3321/demo_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
url: jdbc:mysql://192.168.66.40:3321/demo_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
jdbc-url: jdbc:mysql://192.168.66.40:3321/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
url: jdbc:mysql://192.168.66.40:3321/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
filters: stat,wall,log4j
maxActive: 20
initialSize: 1
......@@ -37,14 +41,14 @@ spring:
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
ds-slave-0:
ds1:
type: com.alibaba.druid.pool.DruidDataSource
# type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver
username: root
password: loit2019ABC
jdbc-url: jdbc:mysql://192.168.66.40:3321/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
url: jdbc:mysql://192.168.66.40:3321/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
jdbc-url: jdbc:mysql://192.168.66.40:3321/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
url: jdbc:mysql://192.168.66.40:3321/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
filters: stat,wall,log4j
maxActive: 20
initialSize: 1
......@@ -59,26 +63,40 @@ spring:
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
masterslave:
load-balance-algorithm-type: round_robin
name: ds_ms
master-data-source-name: ds-master
#slave-data-source-names: ds-slave-0,ds-slave-1
slave-data-source-names: ds-slave-0
#mybatis:
# mapper-locations: classpath:/mapper/**/*.xml #把xml文件放在com.XX.mapper.*中可能会出现找到的问题,这里把他放在resource下的mapper中
# #实体扫描,多个package用逗号或者分号分隔
# typeAliasesPackage: com.company.spring.boot.shardingsphere.seata.modules.entity #这里是实体类的位置
# configuration:
# map-underscore-to-camel-case: true
# cache-enabled: false
sharding:
default-database-strategy:
inline:
sharding-column: user_id
algorithm-expression: ds$->{user_id % 2}
tables:
t_order:
actual-data-nodes: ds$->{0..1}.t_order_$->{0..1}
table-strategy:
inline:
sharding-column: order_id
algorithm-expression: t_order_$->{order_id % 2}
key-generator:
column: order_id
type: SNOWFLAKE
props:
worker.id: 123
t_order_item:
actual-data-nodes: ds$->{0..1}.t_order_item_$->{0..1}
table-strategy:
inline:
sharding-column: order_id
algorithm-expression: t_order_item_$->{order_id % 2}
key-generator:
column: order_item_id
type: SNOWFLAKE
props:
worker.id: 123
mybatis-plus:
# datasource: dataSource
mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
type-aliases-package: com.loit.shardingsphere.seata.modules.entity
type-aliases-package: com.loit.shardingsphere.seata.nacos.feign.modules
#typeEnumsPackage: com.baomidou.springboot.entity.enums
global-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID", 4:"该类型为未设置主键类型", 5:"字符串全局唯一ID";
......
......@@ -5,6 +5,10 @@ spring:
application:
name: loit-shardingshere
cloud:
alibaba:
seata:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应
tx-service-group: loit-shardingshere-seata-service-group
nacos:
discovery:
# Nacos 注册中心地址
......
......@@ -6,6 +6,16 @@ spring:
name: loit-shardingshere
aop: #使用CGLIB来实现AOP的时候
proxy-target-class: true
cloud:
alibaba:
seata:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应
tx-service-group: loit-shardingshere-seata-service-group
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 3ac84119-5558-4bf8-b309-034dd0e458e0
shardingsphere:
datasource:
names: ds0,ds1
......
......@@ -5,6 +5,10 @@ spring:
application:
name: loit-shardingshere
cloud:
alibaba:
seata:
# seata 服务分组,要与服务端nacos-config.txt中service.vgroup_mapping的后缀对应
tx-service-group: loit-shardingshere-seata-service-group
nacos:
discovery:
# Nacos 注册中心地址
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论